]>
git.proxmox.com Git - rustc.git/blob - src/doc/book/listings/ch18-patterns-and-matching/listing-18-01/src/main.rs
2 let favorite_color
: Option
<&str> = None
;
3 let is_tuesday
= false;
4 let age
: Result
<u8, _
> = "34".parse();
6 if let Some(color
) = favorite_color
{
7 println
!("Using your favorite color, {color}, as the background");
9 println
!("Tuesday is green day!");
10 } else if let Ok(age
) = age
{
12 println
!("Using purple as the background color");
14 println
!("Using orange as the background color");
17 println
!("Using blue as the background color");