I need someone to put together a snippet of code for me. This code does NOT have to do anything, it just needs to be syntacially correct.
And include as many variations of
FOR/NEXT (including examples with STEP and DOWNTO in various combos)
DO LOOP (with UNTIL on both ends)
WHILE/WEND
EXIT FOR/WHILE/DO etc… for both inner and outer situations
TRY/CATCH/FINALLY
DIM/VAR … various datatypes, arrays, with/without default values
IF/THEN … single line and with END IF (and ELSEIF conditions)
SUB/FUNCTION
SELECT CASE
END SUB|FUNCTION|SELECT etc
This is to be a test script for my BASIC -> Swift translator… I want someone else to put it together so I do not subconsciously create “easy” scenarios…
What I am looking for now is just those commands that define the STRUCTURE of a program. And if you can think of any other “structure” related keywords, please add them too…
I appreciate any time that anyone is willing to invest in this for me
GOTO/GOSUB were purged from my vocabulary years ago.
Swift doesn’t support a direct correaltion to GOTO, and of course GOSUB is just calling a method (which is by name, not “label”)
Ironically Swift DOES require the use of labels for an “EXIT” that is more than one layer away. (Swift uses the keyword BREAK instead)
loop1:
for i in(0...10) {
for j in(0...10) {
break loop1 // just "break" would exit J loop, this exits I loop
} // next j
} // next i
labels such as these are not required unless the break is more than one layer deep