On this page http://gcbasic.sourceforge.net/index.php
there is a link to some sample code http://gcbasic.sourceforge.net/examples.html
on that page is an example of a morse code generator
within that code is a bunch of nested IF's
on doing some reading in the forum, nested IF's
are not supposed to be supported , so how does the code work ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Nested Ifs are definitely allowed! The morse code generator is quite an old example, I haven't tried it myself since 2006 but it should still work. If you try it and it doesn't work, or if you have any other questions please let us know!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think the problem in that post was the way that the Ifs were nested. The code was like this:
ifvolts>230then'stuff if volts > 150 and volts < 230 then'stuff that can never happen'(if volts is between 150 and 230, the first If will be skipped and so will this) end ifend if
But normally there isn't a problem with having nested Ifs, I quite often use them. Nested Ifs can be more efficient than using And in a condition if you need to check for two things.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
On this page
http://gcbasic.sourceforge.net/index.php
there is a link to some sample code
http://gcbasic.sourceforge.net/examples.html
on that page is an example of a morse code generator
within that code is a bunch of nested IF's
on doing some reading in the forum, nested IF's
are not supposed to be supported , so how does the code work ?
Nested Ifs are definitely allowed! The morse code generator is quite an old example, I haven't tried it myself since 2006 but it should still work. If you try it and it doesn't work, or if you have any other questions please let us know!
Hi Hugh
thanks for reply, so they are in fact supported.
With regards to what was written on this forum about nested IF's , I was referring to the second post in this link, where the replier said nested IF's are not supported
https://sourceforge.net/p/gcbasic/discussion/1073404/thread/52ad3f50/
I think the problem in that post was the way that the Ifs were nested. The code was like this:
But normally there isn't a problem with having nested Ifs, I quite often use them. Nested Ifs can be more efficient than using And in a condition if you need to check for two things.
Thank you I will give it a go, cheers.
standy by, eating words now....
OK, there's a peculiar thing that makes it appear as if it doesn't work.
If you start out like this:
GCB will not recognize the nested if until you put a carriage return/line feed after the else, like this:
the moment you do that, the code will recognize the nested if. Afterwards, you can remove the CRLF, and it still works.
Strange.
Last edit: George Alvarez 2017-12-08