There are not stupid questions, only stupid questioners.
Anyway, kidding aside...
That's how I would code for your first example. There may be others who would do so, differently.
For the second example...
Just thought I'd have some fun and hand you an empty THEN statement. I use this technique sometimes when I rather write the condition one way more than the opposite way. IF ABS(i) <> 10 and ABS(i) <> 0 in this case. The ELSE part wouldn't be needed if I wrote it that way.
The STEP part is a neat way to control the loop. NEGATIVE 1 allowed use to get the - to + output in these examples. You can also skip using STEP -2, STEP 5, STEP -10, etc. STEP can be used with positive numbers to. FOR i = 0 TO 10 STEP 2 would give us... 0, 2, 4, 6, 8, 10. If we used that exclude zero again, we'd get 2, 4, 6, 8, 10 in the output.
Pete
Anyway, kidding aside...
Code: (Select All)
FOR i = 10 TO -10 STEP -1
IF i <> 0 THEN
PRINT i
END IF
NEXT
That's how I would code for your first example. There may be others who would do so, differently.
For the second example...
Code: (Select All)
REM Use your mouse wheel to scroll the console output.
$CONSOLE:ONLY
FOR i = 50 TO -50 STEP -1
IF ABS(i) = 10 OR i = 0 THEN
ELSE
PRINT i
END IF
NEXT
Just thought I'd have some fun and hand you an empty THEN statement. I use this technique sometimes when I rather write the condition one way more than the opposite way. IF ABS(i) <> 10 and ABS(i) <> 0 in this case. The ELSE part wouldn't be needed if I wrote it that way.
The STEP part is a neat way to control the loop. NEGATIVE 1 allowed use to get the - to + output in these examples. You can also skip using STEP -2, STEP 5, STEP -10, etc. STEP can be used with positive numbers to. FOR i = 0 TO 10 STEP 2 would give us... 0, 2, 4, 6, 8, 10. If we used that exclude zero again, we'd get 2, 4, 6, 8, 10 in the output.
Pete