13.07.2015 Views

Turbo Basic

Turbo Basic

Turbo Basic

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The counter variable in the NEXT statement can be omittedaltogether, but if you include it, it must be the right variable. Forexample:FOR n = 1 TO 10ExampleNEXT I NEXT n would work too, but not NEXT m. Although the compiler doesn't care about such things, indent thestatements between FOR and NEXT by two or three spaces to setoff the structure of the loop.Use the EXIT FOR statement to leave a FOR/NEXT loop beforeit has completed.If a NEXT is encountered without a corresponding FOR, runtimeerror 1 occurs, NEXT Without FOR.FOR 1% = 1 TO 10PRINT "For loop iteration" 1%I display iterationsNEXT 1%PRINT "Press any key ... " I pauseWHILE NOT INSTATWENDI use STEP to decrement FOR loopFOR 1% = 50 to 1 STEP -5PRINT "For loop iteration" (45-1%)\ 5I notice the lack of parameter for NEXTNEXTEND<strong>Turbo</strong> <strong>Basic</strong> Reference Directory 211

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!