END IF
IF [condition2] THEN
[code2]
END IF
NEXT
Now, lets say that condition is true and code is executed, but once the code is executed I don't want it to run the second IF..THEN, instead I immediately want to jump to the next iteration of i - is this possible? In pseudo-code:
FOR i = 1 to 10
IF [condition] THEN
NEXT i
END IF
IF [condition2] THEN
[code2]
END IF
NEXT
You're right, SELECT [AS CONST] ... CASE ... is faster and better readable than multiple IF ... ELSEIF ... statements. But you cannot check for multiple conditions (like a = 1, b = "2", c >=3, ...). Instead the same variable is checked against multiple values (like a = 1, a = 2, a >= 3, ...).
for i as Long = 0 to x step 5
Select Case As Const i
Case 0 ' only on first run (of FOR ... NEXT loop)
If a < 0 or a > 99 then ' Bounds checking, if a = index (of array)
... ' raise ERROR or fix a
else
... ' normal operation
endif
Case 5 ' only on second run
...
Case Else ' default option (all remaining cycles)
...
End Select
...
...
next i ' BTW i is optional
An old dirty code - leaving most programmer shouting no no. but it is the same as JMP. and is judicious use of GOTO
Give your Next I a label; viz
CheckI:
Next I
If an IF THEN decision is true directly before END IF say - GOTO CheckI
Of course this will skip to the next iteration but it will start checking from the first IF THEN again and if it remains true none of the other decisions will be checked until the loop ends.
If you wish to Exit the FOR....NEXT loop when an IF....THEN is true without checking anything else then before each END IF you can say EXIT FOR.
(Before EXIT FOR was introduced we used to say i = the maximum plus one)
So the question is what is the purpose not to check the Next IF... THEN