complete exercise variables

This commit is contained in:
_Vulpes 2025-11-22 16:20:58 +01:00
parent 2fb04ac4c2
commit 09154b33c4
6 changed files with 6 additions and 6 deletions

View File

@ -1,6 +1,6 @@
fn main() {
// TODO: Add the missing keyword.
x = 5;
let x = 5;
println!("x has the value {x}");
}

View File

@ -1,6 +1,6 @@
fn main() {
// TODO: Change the line below to fix the compiler error.
let x;
let x = 10;
if x == 10 {
println!("x is ten!");

View File

@ -1,6 +1,6 @@
fn main() {
// TODO: Change the line below to fix the compiler error.
let x: i32;
let x: i32 = 9;
println!("Number {x}");
}

View File

@ -1,6 +1,6 @@
// TODO: Fix the compiler error.
fn main() {
let x = 3;
let mut x = 3;
println!("Number {x}");
x = 5; // Don't change this line

View File

@ -3,6 +3,6 @@ fn main() {
println!("Spell a number: {number}");
// TODO: Fix the compiler error by changing the line below without renaming the variable.
number = 3;
let number = 3;
println!("Number plus two is: {}", number + 2);
}

View File

@ -1,5 +1,5 @@
// TODO: Change the line below to fix the compiler error.
const NUMBER = 3;
const NUMBER: i32 = 3;
fn main() {
println!("Number: {NUMBER}");