From 479ca7ec6d54c94dad88594f4b62a455cff2edf6 Mon Sep 17 00:00:00 2001 From: Bob Nystrom Date: Thu, 12 Jan 2017 11:05:03 -0800 Subject: [PATCH] Improve explanation of single-expression blocks. Fix #390. --- doc/site/syntax.markdown | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/doc/site/syntax.markdown b/doc/site/syntax.markdown index 6aa05fa7..80bbe28d 100644 --- a/doc/site/syntax.markdown +++ b/doc/site/syntax.markdown @@ -124,6 +124,17 @@ same as doing: return "single expression" } +Statements are not allowed in this form (since they don't produce values), which +means nothing starting with `class`, `for`, `if`, `import`, `return`, +`var`, or `while`. If you want a block that contains a single statement, +put a newline in there: + + :::wren + { + if (happy) { + System.print("I'm feelin' it!") + } + } ## Precedence and Associativity