5.3 uBasic primer
85
Finally, the subroutine
restor
is used to restore the initial mode. It simply
does the opposite of subroutine
mode
: instead of stepping right in the mode
menu, it steps left. The number of steps is stored in variable
p
.
5.3
uBasic
primer
After this initial hands-on contact with
uBasic,
we are now going to explore
the language systematically.
5.3.1 Variables
Variables are denoted by a single letter. While early CHDK versions only
supported the letters ‘a’ – ‘j’, newer versions support the letters ‘a’ – ‘z’ and
also the upper case letters ‘A’ – ‘Z’. This results in 52 different variables.
However, in the script header (parameters), only lower-case variable names
are allowed.
Variables can contain both integer and floating-point values. String
variables are not supported in
uBasic.
(Some CHDK spin-offs allow for
string variables.)
5.3.2
Assignments
Assigning a value to a variable starts with the command
let
, for example:
let a = b * c
assigns the product of
b
and
c
to
a
. But
let
is just a noise word; we can omit
it happily without any problems:
a = b * c
means the same and is valid
uBasic,
too. In a CHDK script I would prefer this
notation because it is shorter.
The following arithmetic operators are supported:
+
Addition
-
Subtraction
*
Multiplication
/
Division
%
Remainder
Содержание 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 ...