Class: Melbourne::AST::While
- Defined in:
- lib/melbourne/ast/control_flow.rb
Overview
A while statement as in:
i += 1 while go_on?
Direct Known Subclasses
Instance Attribute Summary collapse
-
#body ⇒ Object
The body of the
whilestatement (the code that is executed if theconditionevaluates to true). -
#check_first ⇒ Object
Whether to check the
whilestatement’s condition before or after ths code in thebodyis executed. -
#condition ⇒ Object
The condition of the
whilestatement.
Attributes inherited from Node
Instance Method Summary collapse
-
#initialize(line, condition, body, check_first) ⇒ While
constructor
A new instance of While.
Methods inherited from Node
Constructor Details
#initialize(line, condition, body, check_first) ⇒ While
Returns a new instance of While.
206 207 208 209 210 211 |
# File 'lib/melbourne/ast/control_flow.rb', line 206 def initialize(line, condition, body, check_first) @line = line @condition = condition @body = body || Nil.new(line) @check_first = check_first end |
Instance Attribute Details
#body ⇒ Object
The body of the while statement (the code that is executed if the condition evaluates to true)
200 201 202 |
# File 'lib/melbourne/ast/control_flow.rb', line 200 def body @body end |
#check_first ⇒ Object
Whether to check the while statement’s condition before or after ths code in the body is executed
204 205 206 |
# File 'lib/melbourne/ast/control_flow.rb', line 204 def check_first @check_first end |
#condition ⇒ Object
The condition of the while statement
196 197 198 |
# File 'lib/melbourne/ast/control_flow.rb', line 196 def condition @condition end |