1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-26 07:25:53 +00:00
QB64-PE/internal/help/WHILE...WEND.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

48 lines
1.4 KiB
Plaintext

The {{KW|WHILE...WEND}} statement is used to repeat a block of statements while the condition is met.
{{PageSyntax}}
:{{KW|WHILE}} {{Parameter|condition}}
:.
:.
:.
:{{KW|WEND}}
{{PageDescription}}
* {{Parameter|condition}} is a numeric expression used to determine if the loop will execute.
* {{Parameter|statements}} will execute repeatedly while {{Parameter|condition}} is a non-zero value.
* [[EXIT]] WHILE can be used for emergency exits from the loop in QB64 only.
* A [[DO...LOOP]] can use the same DO WHILE condition to get the same results.
* WHILE loops only run if the WHILE condition is True.
{{Template:RelationalTable}}
{{PageExamples}}
''Example 1:'' Reading an entire file. Example assumes the program has a [[OPEN|file opened]] as #1
{{CodeStart}} '' ''
{{Cl|OPEN}} &quot;Readme.txt&quot; FOR {{Cl|INPUT (file mode)|INPUT}} AS #1
{{Cl|WHILE...WEND|WHILE}} {{Cl|NOT}} {{Cl|EOF}}(1)
{{Cl|_LIMIT}} 1 'limit line prints to one per second
{{Cl|LINE INPUT (file statement)|LINE INPUT #}}1, text$
IF {{Cl|INKEY$}} = {{Cl|CHR$}}(27) THEN {{Cl|EXIT}} {{Cl|WHILE}} 'ESC key exits
{{Cl|PRINT}} text$
{{Cl|WEND}} '' ''
{{CodeEnd}}
''Example 2:'' Clearing the keyboard buffer.
{{CodeStart}} '' ''
{{Cl|WHILE}} {{Cl|INKEY$}} &lt;&gt; &quot;&quot; : {{Cl|WEND}} '' ''
{{CodeEnd}}
{{PageSeeAlso}}
* [[DO...LOOP]]
* [[FOR...NEXT]]
* [[UNTIL]] (condition)
{{PageNavigation}}