rust/src/test/run-pass/sendfn-is-a-block.rs

8 lines
154 B
Rust
Raw Normal View History

2012-01-23 16:59:00 -06:00
fn test(f: fn(uint) -> uint) -> uint {
2012-08-01 19:30:05 -05:00
return f(22u);
}
fn main() {
2012-08-01 19:30:05 -05:00
let y = test(fn~(x: uint) -> uint { return 4u * x; });
assert y == 88u;
}