DO:LOOP UNTIL iopin From SoundPAL
Chuck Thomas
Posts: 39
Where can I find information on this command?
DO:LOOP UNTIL iopin
I understand this is a·DO:LOOP until IOPIN is TRUE.
Below is the section from the PBASIC Complier 2 manual. Both examples show the DO and the LOOP as seperated items with the test either occuring before or after the test.
Can other conditional loops use this same format such as for...next?
Does this command excute faster? Take up less program memory?
Thank you,
Chuck
[font=CourierNew,Bold size=2]DO [/font]{ [font=CourierNew,Bold size=2]WHILE [/font]| [font=CourierNew,Bold size=2]UNTIL [/font][font=CourierNew,Italic size=2]condition [/font]}
[font=CourierNew,Italic size=2]statement(s)
[/font][font=CourierNew,Bold size=2]LOOP [/font]{ [font=CourierNew,Bold size=2]UNTIL [/font]| [font=CourierNew,Bold size=2]WHILE [/font][font=CourierNew,Italic size=2]condition [/font]}
Parallax, Inc. • BASIC Stamp Editor 2.0 – Beta 2 • 05/2003 6
The condition statement can be setup to cause the loop to run for a specific number of iterations, while
or until a condition becomes true, or indefinitely if no condition is applied. Up to 16 DO…LOOPs may be
nested.
Examples:
[font=CourierNew,Bold size=2]DO
TOGGLE [/font]AlarmPin
[font=CourierNew,Bold size=2]PAUSE [/font]100
[font=CourierNew,Bold size=2]LOOP
DO WHILE [/font](Status = Okay)
StatusLED = IsOn
[font=CourierNew,Bold size=2]PAUSE [/font]100
[font=CourierNew,Bold size=2]LOOP
[/font]In the example above, the condition will be tested before the loop code is executed.
In the next example, the loop code will run at least once because the condition test happens at the end.
[font=CourierNew,Bold size=2]DO
[/font]AlarmLED = IsOn
[font=CourierNew,Bold size=2]PAUSE [/font]1000
[font=CourierNew,Bold size=2]LOOP UNTIL [/font](ovenTemp < ResetThreshold)
DO:LOOP UNTIL iopin
I understand this is a·DO:LOOP until IOPIN is TRUE.
Below is the section from the PBASIC Complier 2 manual. Both examples show the DO and the LOOP as seperated items with the test either occuring before or after the test.
Can other conditional loops use this same format such as for...next?
Does this command excute faster? Take up less program memory?
Thank you,
Chuck
[font=CourierNew,Bold size=2]DO [/font]{ [font=CourierNew,Bold size=2]WHILE [/font]| [font=CourierNew,Bold size=2]UNTIL [/font][font=CourierNew,Italic size=2]condition [/font]}
[font=CourierNew,Italic size=2]statement(s)
[/font][font=CourierNew,Bold size=2]LOOP [/font]{ [font=CourierNew,Bold size=2]UNTIL [/font]| [font=CourierNew,Bold size=2]WHILE [/font][font=CourierNew,Italic size=2]condition [/font]}
Parallax, Inc. • BASIC Stamp Editor 2.0 – Beta 2 • 05/2003 6
The condition statement can be setup to cause the loop to run for a specific number of iterations, while
or until a condition becomes true, or indefinitely if no condition is applied. Up to 16 DO…LOOPs may be
nested.
Examples:
[font=CourierNew,Bold size=2]DO
TOGGLE [/font]AlarmPin
[font=CourierNew,Bold size=2]PAUSE [/font]100
[font=CourierNew,Bold size=2]LOOP
DO WHILE [/font](Status = Okay)
StatusLED = IsOn
[font=CourierNew,Bold size=2]PAUSE [/font]100
[font=CourierNew,Bold size=2]LOOP
[/font]In the example above, the condition will be tested before the loop code is executed.
In the next example, the loop code will run at least once because the condition test happens at the end.
[font=CourierNew,Bold size=2]DO
[/font]AlarmLED = IsOn
[font=CourierNew,Bold size=2]PAUSE [/font]1000
[font=CourierNew,Bold size=2]LOOP UNTIL [/font](ovenTemp < ResetThreshold)
Comments
The DO : LOOP UNTIL iopin construct is two separate statements, separated by a colon (:). It was done this way to save space, since there's nothing to do between the DO and the LOOP.
-Phil
Thanks it makes sense and I seem to remember reading about the colon for seperating commands.
Thank you,
Chuck