Created
January 4, 2022 16:27
-
-
Save eduardonunesp/dcb680e17d7d576b2fb0acdb402d5be2 to your computer and use it in GitHub Desktop.
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
type CbFunc = fn(); | |
fn main() { | |
call_func(print_hello); | |
call_func(|| println!("{}", "haloo :D")); // Closure | |
} | |
fn call_func(f: CbFunc) { | |
f(); | |
} | |
fn print_hello() { | |
println!("Hello, world!"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment