Rust - Data Types Flashcards
What typed language is rust
Statically typed
True or false: The compiler can automatically infer data type of the variable based on the value assigned to it?
True
How do you declare a variable in rust
let first_name = “Prince”;
let do_i_like_rust = false;
println!(“{} does not like rust”, first_name);
A scalar type represents what type of value?
single
Rust has how many scalar types?
4.
Integer
Floating-point
Booleans
Characters
Mention the classifications of integers
Signed and unsigned.
Signed: i8,i16,i32,i64
Unsigned: u8, u16,u32,u64… usize
Declare variable showing the use of unsigned and signed integers
let age: u32 = 19;
let sum: i32 = 5-15;
Classifications for float
f32 and f64.
Single and double precision
True or false: Automatic type casting is allowed in rust?
false