How can we tell the compiler that we want x to be an int?

Rust has a way of informing both the compiler and the developer of the variable type. For example, for a 32-bit int, we would use the following:

let x = 1i32; 

In other words, x = 1, a 32-bit signed int.

If a variable is defined without the i32 (or any other value), the compiler will decide the type depending on how the value is used, defaulting to i32.
..................Content has been hidden....................

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