Skip to content

if

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

Supports runtime fields inside smart blocks. Use explicit @helper! expressions or captured outputs; other fields are evaluated at build time.

if <condition> <thenBlock> [elseBlock]
NameTypeEvaluationDescription
conditionboolRuntime in smart blocksWhether to execute the then block
thenBlockblockBuild timeCommands when condition is true
[elseBlock]blockBuild timeCommands 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