Created
December 27, 2018 21:25
-
-
Save rust-play/05cc49bb7e29b90aa58d56f218697cd4 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn call<F>(a: i64, b: i64, c: F) -> i64 where F: Fn(i64, i64) -> i64 { | |
c(a, b) | |
} | |
fn main() { | |
println!("{}", call(10, 10, |a, b| a + b)); | |
println!("{}", call(20, 10, |a, b| a - b)); | |
println!("{}", call(30, 10, |a, b| a * b)); | |
println!("{}", call(40, 10, |a, b| a / b)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment