rust/src/test/run-pass/block-arg-can-be-followed-by-binop.rs
Niko Matsakis 21519bc7e0 demode vec
2012-09-28 13:27:45 -07:00

9 lines
186 B
Rust

fn main() {
let v = ~[-1f, 0f, 1f, 2f, 3f];
// Trailing expressions don't require parentheses:
let y = do vec::foldl(0f, v) |x, y| { x + *y } + 10f;
assert y == 15f;
}