The u32
stands for 32-bit unsigned integer type. It is an unsigned integer because it cannot contain a negative value like signed integers. The range of u32
is 0 to 4294967295
. In order to get the smallest value of this integer type, we must use the MIN
constant.
u32::MIN
This method requires no parameter.
This method returns the value 0
.
Let's look at the code below:
fn main() {// print the MIN constantprintln!("{}", u32::MIN);// perform some operations with itprintln!("{}", u32::MIN + 1);println!("{}", u32::MIN / 1 + 10);println!("{}", u32::MIN + 500 - 100);println!("{}", u32::MIN * 78);}
MIN
constant.MIN
constant of the u32
and print the results to the console.