Update block.md

This commit is contained in:
Flaviu Tamas 2015-01-02 16:50:48 -05:00
commit fcec1ae159

View file

@ -21,7 +21,9 @@ block:
let b = "3" # shadowing is probably a dumb idea let b = "3" # shadowing is probably a dumb idea
``` ```
Parentheses can be used as an expression, but they do not provide end of statement inference, so it is necessary to place semicolons yourself. An interesting and unexpected side effect of this syntax is that Nim is suitable even for brace purists! Parentheses can be used as an expression, but they do not provide end of statement inference, so it is necessary to place semicolons yourself. An interesting and unexpected side effect of this syntax is that Nim is suitable even for die-hard brace purists!
While possible, it doesn't mean it's a good idea. Most Nim code does not use parentheses in that way, and it would not be seen as idiomatic.
``` nimrod ``` nimrod
proc square(inSeq: seq[float]): seq[float] = ( proc square(inSeq: seq[float]): seq[float] = (
@ -32,10 +34,11 @@ proc square(inSeq: seq[float]): seq[float] = (
) )
``` ```
<!-- XXX FIX <!-- XXX FIX
square(( # A 1001 long sequence to be squared square(( # A 1001 long sequence to be squared
var result = newSeq[float](); var result = newSeq[float]();
for i in 0..1000: for i in 0..1000:
result.add(i); result.add(i);
result result
))--> ))-->