if
Conditionally execute a block of commands, with an optional else block.
Syntax
Section titled “Syntax”if <condition> <thenBlock> [elseBlock]Arguments
Section titled “Arguments”| 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 |
Examples
Section titled “Examples”# Simple conditionif true ( print "yes")
# Boolean expressionif @bool(1 == 1) ( print "equal")
# If-elseset $x 10if @bool($x > 0) ( print "positive") ( print "non-positive")See Also
Section titled “See Also”- @bool — boolean expressions