Created
July 23, 2021 16:53
-
-
Save aaripurna/42f00e9a9b3c31b3473f54cd8b746f26 to your computer and use it in GitHub Desktop.
depp nessted match mattern
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
match connect_database() { | |
Ok(mut conn) => match conn.fetch_user() { | |
Ok(user) => conn.get_post(user.id) { | |
Ok(post) => conn.get_comments(post.id) { | |
Ok(_comments) => println!("We got the coments"), | |
Err(_) => println!("its error, no comment") | |
} | |
Err(_) => println!("Can't find post") | |
} | |
Err(_) => println!("Can't find user") | |
} | |
Err(_) => println!("Database connetion failed") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment