Files
wren/test/if/if.wren
T
Bob Nystrom 4a8cf3a7bf Move newline handling down into parser.
This lets us make it a grammar feature and not a lexer trick.
Newlines are explicitly ignored in some parts of the grammar. This
lets, for example, things like "|" ignore the newline when used as
an operator, but not when used as a parameter delimiter in a block
argument.
2014-04-04 07:51:18 -07:00

11 lines
289 B
Plaintext

// Evaluate the 'then' expression if the condition is true.
if (true) IO.print("good") // expect: good
if (false) IO.print("bad")
// Allow block body.
if (true) { IO.print("block") } // expect: block
// Assignment in if condition.
var a = false
if (a = true) IO.print(a) // expect: true