Skip to content

if

Conditionally execute a block of commands, with an optional else block.

if <condition> <thenBlock> [elseBlock]
Name Type Description
condition bool Whether to execute the then block
thenBlock block Commands when condition is true
[elseBlock] block Commands when condition is false
# Simple condition
if true (
print "yes"
)
# Boolean expression
if @bool(1 == 1) (
print "equal"
)
# If-else
set $x 10
if @bool($x > 0) (
print "positive"
) (
print "non-positive"
)
  • @bool — boolean expressions