Loops/Infinite: Difference between revisions

Content added Content deleted
(GDScript)
(Added Chipmunk Basic, GW-BASIC, MSX Basic and Quite BASIC)
Line 414: Line 414:
end while</syntaxhighlight>
end while</syntaxhighlight>


==={{header|Commodore BASIC}}===
==={{header|Chipmunk Basic}}===
{{works with|Chipmunk Basic|3.6.4}}
<syntaxhighlight lang="qbasic">10 while 1
20 print "SPAM"
30 wend</syntaxhighlight>


==={{header|Commodore BASIC}}===
In addition to the general examples listed above for [[#BASIC|BASIC]], there is a trick to get a Commodore BASIC program to endlessly loop its listing. All of the lines of code are a linked list in RAM. The trick is accomplished by modifying the pointer to the next line, which is recorded at the very start of each tokenized BASIC line. Instead of it pointing to the next line, you can make it point to a previous line, or itself. This will affect execution when any <code>GOTO</code> or <code>GOSUB</code> needs to reference any line number '''after''' the affected line, since the line search will be corrupted (and endless...)
In addition to the general examples listed above for [[#BASIC|BASIC]], there is a trick to get a Commodore BASIC program to endlessly loop its listing. All of the lines of code are a linked list in RAM. The trick is accomplished by modifying the pointer to the next line, which is recorded at the very start of each tokenized BASIC line. Instead of it pointing to the next line, you can make it point to a previous line, or itself. This will affect execution when any <code>GOTO</code> or <code>GOSUB</code> needs to reference any line number '''after''' the affected line, since the line search will be corrupted (and endless...)


Line 447: Line 452:
ready.
ready.
&#9608;</pre>
&#9608;</pre>

==={{header|GW-BASIC}}===
{{works with|PC-BASIC}}
<syntaxhighlight lang="qbasic">10 WHILE 1
20 PRINT "SPAM"
30 WEND</syntaxhighlight>
Also
<syntaxhighlight lang="qbasic">10 PRINT "SPAM"
20 GOTO 10</syntaxhighlight>


==={{header|IS-BASIC}}===
==={{header|IS-BASIC}}===
Line 452: Line 466:
110 PRINT "SPAM"
110 PRINT "SPAM"
120 LOOP</syntaxhighlight>
120 LOOP</syntaxhighlight>

==={{header|MSX Basic}}===
<syntaxhighlight lang="qbasic">10 FOR I = 1 TO 10 STEP 0
20 PRINT "SPAM"
30 NEXT I</syntaxhighlight>
Also
<syntaxhighlight lang="qbasic">10 PRINT "SPAM"
20 GOTO 10</syntaxhighlight>


==={{header|QB64}}===
==={{header|QB64}}===
Line 464: Line 486:
Wend</syntaxhighlight>
Wend</syntaxhighlight>


==={{header|Quite BASIC}}===
<syntaxhighlight lang="qbasic">10 print "SPAM"
20 goto 10</syntaxhighlight>


==={{Header|Tiny BASIC}}===
==={{Header|Tiny BASIC}}===