Re: EOF and GOTO and 0th array element
- Posted by Kat <gertie at PELL.NET> Aug 22, 2002
- 521 views
On 22 Aug 2002, at 19:56, darceman wrote: > 2. At the risk of incurring wrath for writing spaghetti code, is there a > GOTO equivalent? In Karl's Bach/Bliss, but not in Euphoria. > 3. in BASIC an array can be created with 0th (zeroth?) element in any > dimension, but I don't see how you can do that in a sequence. Can one > set up a Euphoric equivalent to such an element in a sequence? No, the first element is one. I once tried indexing my zero-eth finger, and got lost. Only time i found this useful was in getting the string length, and Eu doesn't do strings at all, only sequences. Which can be quite an advantage. It would be nice if a out-of-range index would return "" tho. > 4. Nested in a while...end while loop is a for..end for loop. If a > test fails in the for..end for loop I want to exit the while..end while > loop. However, using exit command in the for..end for loop seems to > only exit the "for" loop and does not apply to the "while" loop. Can > one indicate what to exit if using that command, or (as in the example > below) do I have to set some condition in the "for" loop to test outside > of it in order to exit the "while" loop? No, for that, you need to use spagettti code, with extra vars to set and do boolean tests on to see what to exit and when it's ok to continue to loop. Do a lot of if-then blocking, and move the logical program flow out into other functions and procedures, and deal with the fallout of var scopes. Moving code out into other functions makes recursion really difficult, but since we cannot goto the EndOf_Whatever loop, or any other goto :target: like in Bach/Bliss or basic, basic-to-Euphoria translators cannot handle the simple elegant "goto". Kat