spudplate
Template scaffolding compiler for spudlang .spud files
Loading...
Searching...
No Matches
spudplate::IfStmt Struct Reference

An if statement - executes its body when the condition is true. More...

#include <ast.h>

Public Attributes

ExprPtr condition
 Expression that must evaluate to bool true to enter the body.
 
std::vector< StmtPtr > body
 Statements inside the conditional block.
 
int line
 1-based source line where this node begins.
 
int column
 1-based source column where this node begins.
 

Detailed Description

An if statement - executes its body when the condition is true.

Example:

if use_tests
mkdir "tests"
file "tests/README.md" content "# Tests"
end

Mirrors repeat structurally: a condition expression, a body, and an end terminator. There is no else or else if; gating gating composes via nested if blocks. let and as declared inside the body are local; the usual no-shadowing rule applies. Inner statements may carry their own when clause; an if block does NOT itself accept a when clause.