fn closure in RBE

This commit is contained in:
Dan Buch 2023-09-30 20:17:22 -04:00
parent 9d4f5b661b
commit aa83db6f7a
Signed by: meatballhat
GPG Key ID: A12F782281063434

View File

@ -0,0 +1,12 @@
fn main() {
let outer_var = 42;
let closure_annotated = |i: i32| -> i32 { i + outer_var };
let closure_inferred = |i| i + outer_var;
println!("closure_annotated: {}", closure_annotated(1));
println!("closure_inferred: {}", closure_inferred(1));
let one = || 1;
println!("closure returning one: {}", one());
}