Blocks; Conditional Clauses - Canon Camera Hackers Manual

Camera hackers manual berthold daum
Table of Contents

Advertisement

The CHDK functions cls() and print_screen() work exactly the same
as the equivalent commands in uBasic. There is one exception:
print_screen(false)
can be used to disable output to a log file.

5.4.6 Blocks

Blocks are statement sequences that are enclosed by do ... end. Their
main purpose is to allow the definition of local variables that are only valid
within the block. Blocks may be nested.

5.4.7 Conditional clauses

Similar to uBasic, conditional clauses are built with the if ... then ...
else ... end construct. The difference is that the construct is not closed
by a specific endif token but by the more generic end token. For example:
if a < 0 then
b = 3
else
b = 4
end
The else clause may be omitted, but in contrast to uBasic, it is not possible
to omit the end token even for single line constructs:
if n < 0 then n = 0 end
Nested if statements can be simplified with the elseif token. Instead of:
if a < 0 then
b = -1
else
if a > 0 then
b = 1
else
b = 0
end
end
95
5.4 Lua primer

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Powershot sx10 is

Table of Contents