Contents

Conditions


Any command can be made conditional by appending an if clause as its last parameter. If the condition is false, the command is skipped.

A condition is one or more comparisons of the form <value> <operator> <value>. The left value is usually a variable reference (expanded before the comparison); the right value is a literal.

Operators:

=   - equal (string comparison)
^   - not equal (string); != and <> are synonyms
>   - greater than (numeric)
<   - less than (numeric)
>= - greater than or equal (numeric)
<= - less than or equal (numeric)

Numeric operators compare the values as numbers, using the 0x/decimal rule (a 0x or $ prefix means hexadecimal, otherwise decimal). Several comparisons can be joined with AND and OR, evaluated left to right. Values inside an if clause must not contain spaces.

Standard if statement syntax:

messagebox "Do you want to patch the program?", 4, "Patch", retval
; If "Yes" is clicked (retval = 6)
messagebox "You selected Yes", 16, "Yes", retval1, if retval = 6
; If "No" is clicked (retval = 7)
messagebox "You selected No", 16, "No", retval2, if retval = 7

Combining comparisons:

; Continue only when the size is positive and the state is "ok"
goto ready, if @_size > 0 AND @_state = ok
; Branch when the code is 1 or 2
goto retry, if @_code = 1 OR @_code = 2

 

Copyright © 2001 - 2026, DotFix Software