2nd step
This commit is contained in:
33
src/main.rs
33
src/main.rs
@@ -1,13 +1,38 @@
|
|||||||
|
fn print_type_of<T>(_: &T) {
|
||||||
|
println!("{}", std::any::type_name::<T>())
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// let mut x = 5;
|
// let mut x = 5;
|
||||||
// println!("The value of x is: {}", x);
|
// println!("The value of x is: {}", x);
|
||||||
// x = 6;
|
// x = 6;
|
||||||
// println!("The value of x is: {}", x);
|
// println!("The value of x is: {}", x);
|
||||||
let x = 5;
|
|
||||||
|
|
||||||
let x = x + 1;
|
// let x = 5;
|
||||||
|
|
||||||
let x = x * 2;
|
// let x = x + 1;
|
||||||
|
|
||||||
println!("The value of x is: {}", x);
|
// let x = x * 2;
|
||||||
|
|
||||||
|
// println!("The value of x is: {}", x);
|
||||||
|
|
||||||
|
// addition
|
||||||
|
let sum = 5 + 10;
|
||||||
|
print_type_of(&sum);
|
||||||
|
|
||||||
|
// subtraction
|
||||||
|
let difference = 95.5 - 4.3;
|
||||||
|
print_type_of(&difference);
|
||||||
|
|
||||||
|
// multiplication
|
||||||
|
let product = 4 * 30;
|
||||||
|
print_type_of(&product);
|
||||||
|
|
||||||
|
// division
|
||||||
|
let quotient = 56.7 / 32.2;
|
||||||
|
print_type_of("ient);
|
||||||
|
|
||||||
|
// remainder
|
||||||
|
let remainder = 43 % 5;
|
||||||
|
print_type_of(&remainder);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user