5.3 uBasic primer
89
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"
Содержание Camera
Страница 1: ......
Страница 2: ...The Canon Camera Hackers Manual ...
Страница 3: ......
Страница 4: ...Berthold Daum The Canon Camera Hackers Manual Teach Your Camera New Tricks ...
Страница 19: ...10 CH APTER 2 Cameras and Operating Systems ...
Страница 25: ...16 CH APTER 3 ...
Страница 85: ...76 CH APTER 4 Teach Your Camera New Tricks ...
Страница 213: ...204 CH APTER 6 ...
Страница 253: ...244 AP PENDIX ...