Skip to content
Justice Tech School

Scalar Types

Integers i8 to i128 and u8 to u128, floats f32 and f64, bool and char. Default int is i32, float f64.

Example
fn main() {
    let a: i32 = -5; let b: u8 = 255; let c = 2.5_f64; let d = true; let e = 'R';
    println!("{} {} {} {} {}", a, b, c, d, e);
    println!("{} {}", i32::MAX, u8::MIN);
}

Result

-5 255 2.5 true R
2147483647 0

Exercise

Unsigned byte.

let b:  = 255;

Quiz Test

What is the default integer type?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.