rust/src/test/run-pass/block-vec-map2.rs
Niko Matsakis 21519bc7e0 demode vec
2012-09-28 13:27:45 -07:00

11 lines
246 B
Rust

extern mod std;
fn main() {
let v =
vec::map2(~[1, 2, 3, 4, 5],
~[true, false, false, true, true],
|i, b| if *b { -(*i) } else { *i } );
log(error, v);
assert (v == ~[-1, 2, 3, -4, -5]);
}