graydon/rust — Issue #1054: Support Ruby-style block arguments
Author: marijnh
Created: 2011-10-21 09:32:12+00:00
State: open

```
uint::range(0, 10) {|x| ... };
mymap.each {|key, val| ...};
```

A block (`{` followed by `|` or `||`) appearing after an expression is (with the same precedence as `x.y`, `x[y]`, `x()`, etc) treated as a block value passed to a function. If the expression was a call, the block argument is added as a last argument. If it was a non-call, it becomes a call with a single argument.