ESCGrammarStmts.If
Extends: ESCGrammarStmt
Description
Represents an if statement. Uses the form:
if <expression>:
<block>
elif <expression>:
<block>
else:
<block>
Can contain multiple
elifblocks.elifandelseblocks are optional.
Members
Methods
init
func init(condition: ESCGrammarExpr, then_branch: ESCGrammarStmts.Block, elif_branches: Array, else_branch: ESCGrammarStmts.Block) -> void
Initialization method. Must be called after instantiation.
Parameters
Name |
Type |
Description |
Required? |
|---|---|---|---|
condition |
|
the expression to be evaluated and tested for the |
yes |
then_branch |
|
the block of statements to be executed should |
yes |
elif_branches |
|
an array containing any desired |
yes |
else_branch |
|
the block of staetments to be executed should |
yes |
Returns
Returns nothing.
get_condition
func get_condition() -> ESCGrammarExpr
The expression/predicate to be evaluated for the if block.
Parameters
None.
Returns
Returns the expression/predicate to be evaluated for the if block. (ESCGrammarExpr)
get_then_branch
func get_then_branch() -> ESCGrammarStmts.Block
The block of statements to be executed should condition evaluate to true.
Parameters
None.
Returns
Returns the block of statements to be executed should condition evaluate to true. (ESCGrammarStmts.Block)
get_elif_branches
func get_elif_branches() -> Array
The array of elif branches to include as part of this if statement.
Parameters
None.
Returns
Returns the array of elif branches to include as part of this if statement. (Array)
get_else_branch
func get_else_branch() -> ESCGrammarStmts.Block
The block of statements to be executed should condition evaluate to false.
Parameters
None.
Returns
Returns the block of statements to be executed should condition evaluate to false. (ESCGrammarStmts.Block)
accept
func accept(visitor: Variant) -> Variant
Method to invoke visitor-specific code.
Parameters
Name |
Type |
Description |
Required? |
|---|---|---|---|
visitor |
|
Visitor instance invoked to process this statement. |
yes |
Returns
Returns nothing.