# Macro Language: Control Commands

`if <expr> <operator> <expr>`
`else`
`endif`

Executes the commands between `if ...` and `else` if the condition is true. If the condition is false it executes the commands between `else` and `endif`. Possible operators are `==`, `!=`, `>`, `<`, `>=`, `<=` for numerical comparison and `eq`, `ne` for string comparison. It is not possible to define if,else,endif statements inside another `if`, `else`, `endif` statements.

`loop <RANGE>`

Starts a loop for the given range. The running variable for the loop command is `l`. It is not possible to define loops inside another loop.

`bufferloop <BUFFER>`

Starts a loop for the given buffer numbers. The running variable for the loop command is `l`. It is not possible to define buffer loops inside another loop.

`dataloop <buffer>`

Starts a loop for all data points in the given buffer. The running variable for the loop command is `l`, in this case the same as the point number in the buffer. During the loop the variables `lx`, `ly`, `lxe`, `lye` contains the values of the corresponding data point. It is not possible to define data loops inside another loop.

`endloop`

The endpoint of a `loop`, `bufferloop` or `dataloop` command.

`timer <interval> [count]`

Set a timer on the current macro. The macro will be executed every <interval> seconds. With [count] the timer can be stopped after that number of executions. The variable `timercount` contains a counter of executions.

`stoptimer`

Stop a running timer.

`perltimeout <seconds>`

Set the timeout for inline Perl execution in macros. Default is 10 seconds.