71 lines
1.9 KiB
Plaintext
71 lines
1.9 KiB
Plaintext
================================================================================
|
|
While Loop
|
|
================================================================================
|
|
|
|
while true {
|
|
output ("This is a bad idea...")
|
|
}
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(root
|
|
(statement
|
|
(statement_kind
|
|
(while
|
|
(expression
|
|
(value
|
|
(boolean)))
|
|
(block
|
|
(statement
|
|
(statement_kind
|
|
(expression
|
|
(function_call
|
|
(function_expression
|
|
(identifier))
|
|
(expression
|
|
(value
|
|
(string))))))))))))
|
|
|
|
================================================================================
|
|
Nested While Loop
|
|
================================================================================
|
|
|
|
while true {
|
|
while x > 0 {
|
|
x -= 1
|
|
}
|
|
}
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(root
|
|
(statement
|
|
(statement_kind
|
|
(while
|
|
(expression
|
|
(value
|
|
(boolean)))
|
|
(block
|
|
(statement
|
|
(statement_kind
|
|
(while
|
|
(expression
|
|
(logic
|
|
(expression
|
|
(identifier))
|
|
(logic_operator)
|
|
(expression
|
|
(value
|
|
(integer)))))
|
|
(block
|
|
(statement
|
|
(statement_kind
|
|
(assignment
|
|
(identifier)
|
|
(assignment_operator)
|
|
(statement
|
|
(statement_kind
|
|
(expression
|
|
(value
|
|
(integer)))))))))))))))))
|