1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-26 17:55:52 +00:00
QB64-PE/internal/help/NEXT.txt
SMcNeill 6e01fc8dce Altered string compare routines (<,<=,>,>=) so they don't give false results with CHR$(0).
Added new _STRCMP and _STRICMP commands for quick string comparisons.
Cleaned up QB64 to finish removing the QUI (quick user insert) code and folders.
Altered UCASE and LCASE routines to be faster in some situations for us.
2014-09-22 08:19:03 -04:00

44 lines
1.4 KiB
Plaintext

'''NEXT''' is used in a [[FOR...NEXT|FOR]] counter loop to progress through the loop count or to [[RESUME]] on the NEXT code line after an error.
{{PageSyntax}}
:: FOR i = 1 TO 10
::.
::. 'loop code
::.
::NEXT i
:OR
:: RESUME NEXT
* NEXT is required in a FOR loop or a [[ERROR Codes|&quot;FOR without NEXT&quot; error]] will occur.
* The FOR variable name is not required after NEXT.
* NEXT can be grouped with other NEXTs in nested FOR loops using colons like NEXT: NEXT
* NEXT can also end more than one nested [[FOR...NEXT|FOR]] loop using comma separated variables like NEXT i, j
* NEXT increases the FOR loop count so the variable value AFTER the FOR loop will be one more count than the requested count.
* Also used in [[ON ERROR]] [[GOTO]] procedures after [[RESUME]] to return the program to the next code line only after an [[ERROR Codes|error]] occurs.
''Example:'' Finding the FOR variable value AFTER a simple counter loop to 10.
{{CodeStart}} '' ''
FOR i = 1 TO 10
PRINT i;
NEXT i
PRINT &quot;AFTER the LOOP, NEXT makes the value of i =&quot;; i '' ''
{{CodeEnd}}
{{OutputStart}}
1 2 3 4 5 6 7 8 9 10 AFTER the LOOP, NEXT makes the value of i = 11
{{OutputEnd}}
''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:''
* [[FOR...NEXT]]
* [[DO...LOOP]]
* [[RESUME|RESUME NEXT]]
{{PageNavigation}}