Macro Programming Language 161
FXDeko User’s Guide
type "Hello"
else
if $a==5
type "Good-bye"
else
type "Wish you were here"
end
end
…or more elegantly by using the elseif command:
if $a==1
type "Hello"
elseif $a==5
type "Good-bye"
else
type "Wish you were here"
end
Notice how indentation makes conditional statements easier to read. Indenting
the commands between if and its corresponding end is a good practice.
Loop commands instruct FXDeko to execute a series of commands multiple
times. Loop commands include loop, while and for.
The easiest way to define a loop is to use the loop command and specify the
number of iterations:
loop [count=]
# commands
end
The macro executes the command sequence between loop and end the number
of times specified by the count parameter. After the loop, the macro continues
with the first command after end.
If you do not supply a count, the loop will go on forever or until you cancel
macro playback or use a conditional statement to end the loop.
The following macro types “hello” five times, then breaks out of the loop:
$a=1
loop
type "hello";newline
$a = $a+=1
if $a>5
break
end
end