Created
July 23, 2021 15:38
-
-
Save aaripurna/b291ca3926c37cc7b1cca8b56ca91fb9 to your computer and use it in GitHub Desktop.
Null handling in rust
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
// Sometimes will retun None | |
fn some_operation() -> Option<String> { | |
// Some operation that may return None | |
} | |
fn write_text() { | |
match some_iperation() { | |
Some(text) => println!("{}", text), | |
None => println!("There is nothing") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment