complete variables exercises

This commit is contained in:
Kathode 2024-02-12 19:50:41 +11:00
parent b220d91356
commit c23ee60d1e
6 changed files with 7 additions and 13 deletions

View File

@ -5,9 +5,8 @@
// Execute `rustlings hint variables1` or use the `hint` watch subcommand for a
// hint.
// I AM NOT DONE
fn main() {
x = 5;
let x:i8 = 5;
println!("x has the value {}", x);
}

View File

@ -3,10 +3,9 @@
// Execute `rustlings hint variables2` or use the `hint` watch subcommand for a
// hint.
// I AM NOT DONE
fn main() {
let x;
let x:i8 = 11;
if x == 10 {
println!("x is ten!");
} else {

View File

@ -3,9 +3,8 @@
// Execute `rustlings hint variables3` or use the `hint` watch subcommand for a
// hint.
// I AM NOT DONE
fn main() {
let x: i32;
let x: i32 = 0;
println!("Number {}", x);
}

View File

@ -3,10 +3,9 @@
// Execute `rustlings hint variables4` or use the `hint` watch subcommand for a
// hint.
// I AM NOT DONE
fn main() {
let x = 3;
let mut x = 3;
println!("Number {}", x);
x = 5; // don't change this line
println!("Number {}", x);

View File

@ -3,11 +3,10 @@
// Execute `rustlings hint variables5` or use the `hint` watch subcommand for a
// hint.
// I AM NOT DONE
fn main() {
let number = "T-H-R-E-E"; // don't change this line
let number: &str = "T-H-R-E-E"; // don't change this line
println!("Spell a Number : {}", number);
number = 3; // don't rename this variable
let number:i8 = 3; // don't rename this variable
println!("Number plus two is : {}", number + 2);
}

View File

@ -3,9 +3,8 @@
// Execute `rustlings hint variables6` or use the `hint` watch subcommand for a
// hint.
// I AM NOT DONE
const NUMBER = 3;
const NUMBER:i8 = 3;
fn main() {
println!("Number {}", NUMBER);
}