Advertisement
cwchen

[Rust] if-else if-else demo

Aug 22nd, 2017
618
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.23 KB | None | 0 0
  1. fn main() {
  2.     let x = 0;
  3.  
  4.     if x > 0 {
  5.         println!("x is larger than zero");
  6.     } else if x == 0 {
  7.         println!("x is equal to zero");
  8.     } else {  // x < 0
  9.         println!("x is smaller than zero");
  10.     }
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement