And back to if let

You have probably realized now that if let is, in actuality, a match construct that is just written in a slightly different way.

A match construct is as follows:

match testmatch 
{ 
    1 => println!("1"), 
    _ => println!("not 1") 
} 

The if let version would be as follows:

if let 1 = testmatch { 
    println!("1"); 
} 
 else 
 { 
    println!("not 1"); 
} 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset