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
5.3 uBasic primer
85