Explorar el Código

if

is an expression.  semicolons are a little weird, but they do make
sense.  (why weird?  because you don't have to write them in the body of
`main`, supposedly because it returns nothing.)
Lucas Stadler %!s(int64=10) %!d(string=hace) años
padre
commit
5d50eb3eff
Se han modificado 1 ficheros con 5 adiciones y 1 borrados
  1. 5 1
      rust/book/src/main.rs

+ 5 - 1
rust/book/src/main.rs

@ -2,5 +2,9 @@ fn main() {
2 2
    let x = 5;
3 3
4 4
    println!("Hello, World!");
5
    println!("THE number is {}", x);
5
    if x == 42 {
6
        println!("It's THE ANSWER!");
7
    } else {
8
        println!("Meh, it's just a number, {}.", x);
9
    }
6 10
}