Labels And Gotos - Canon Camera Hackers Manual

Camera hackers manual berthold daum
Table of Contents

Advertisement

Another loop construct is the while ... wend construct. Here, you have
to organize your counters by yourself. while ... wend loops run until an
arbitrary logical condition fails.
i = 1
while i <= n
sleep 10000
print "Shot", i, "of", n
shoot
i = i + 1
wend
does exactly the same as the for-loop shown before.
The construct do ... until is quite similar:
i = 1
do
sleep 10000
print "Shot", i, "of", n
shoot
i = i + 1
until i > n
The difference with the while ... wend construct is that the loop body is
executed at least once because the condition is checked at the end of the
loop. The while ... wend construct may not execute the loop body at all if
the condition after the while fails during the first pass.
In the CHDK implementation of uBasic, loops can be nested to a depth
of four.

5.3.7 Labels and GOTOs

The goto statement allows you to leave the linear execution and jump to
another location in the script. While early uBasic versions only supported
line numbers after the goto, recent uBasic versions support labels. This is
much better because line numbers are subject to change when new lines
are inserted into a script.
goto "restart"
5.3 uBasic primer
89

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Powershot sx10 is

Table of Contents