1
0
Fork 0
mirror of https://github.com/notohh/rustlings.git synced 2025-10-12 13:35:20 -04:00

Original exercises

This commit is contained in:
Nidhal Messaoudi 2023-02-27 21:33:28 +01:00
commit 278a1f103b
27 changed files with 87 additions and 58 deletions

View file

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

View file

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

View file

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

View file

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

View file

@ -1,9 +1,11 @@
// variables5.rs
// 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
println!("Spell a Number : {}", number);
let number = 3; // don't rename this variable
number = 3; // don't rename this variable
println!("Number plus two is : {}", number + 2);
}

View file

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