EasyManua.ls Logo

Canon Camera - Loops

Canon Camera
257 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
88 CHAPTER 5 Scripting
select x
case 3,4,7; print "3, 4, or 7"
case 10 to 20; print "10 to 20"
case_else print "neither"
end_select
The first case statement specifies a list of values that can be of arbitrary
length. If the value of x matches a list element, the instruction behind the
semicolon is executed. In contrast, the second case statement specifies a
value range. If the value of x is within that range, the statement behind the
semicolon is executed. Optionally, a case_else statement can be used to
execute a statement if none of the specified case statements did apply. If
you want to execute more than one instruction after a case statement, you
must enclose those instructions into a subroutine and call it with gosub
(section 5.3.8).
Note: If you also plan to write scripts that run on the Stereo Data Maker
( SDM, section 7.9), you should avoid the select statement because it is not
supported in the SDM.
5.3.6 Loops
The for-loop is used to increment a counter from a start value to an end
value and to execute the instructions within the loop for each counter
value:
for i = 1 to n
sleep 10000
print "Shot", i, "of", n
shoot
next i
takes n shots every ten seconds and prints a protocol for each shot on the
display. As you can see, the for-construct is closed with the command next
specifying the variable to be incremented.
By default, the increment value of the for-construct is 1. By using the
step clause, however, it is possible to specify a different increment value:
for i = 1 to 10 step 3
print i
next i
will print the values 1, 4, 7, 10.

Table of Contents

Related product manuals