QB64.com

QB64 is a modern extended BASIC programming language that retains QBasic/QuickBASIC 4.5 compatibility and compiles native binaries for Windows, Linux, and macOS.

NEXT is used in a FOR…NEXT counter loop to progress through the loop count.

Syntax

FOR counterVariable = startValue TO stopValue [STEP increment] {code}NEXT [counterVariable]

Description

Example(s)

Finding the FOR variable value AFTER a simple counter loop to 10.


FOR i = 1 TO 10
  PRINT i;
NEXT i

PRINT "AFTER the LOOP, NEXT makes the value of i ="; i 


1 2 3 4 5 6 7 8 9 10 AFTER the LOOP, NEXT makes the value of i = 11

Result: The last value of i = 11 although FOR only looped 10 times. Only use the count values while inside of the loop or compensate for this behavior in your code.

See Also