mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-06 18:59:19 +00:00
Variables exercise completed
This commit is contained in:
parent
88b583f2bb
commit
ccd816d57f
@ -13,7 +13,6 @@
|
||||
// Execute `rustlings hint intro1` or use the `hint` watch subcommand for a
|
||||
// hint.
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
fn main() {
|
||||
println!("Hello and");
|
||||
|
||||
@ -5,8 +5,6 @@
|
||||
// Execute `rustlings hint intro2` or use the `hint` watch subcommand for a
|
||||
// hint.
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
fn main() {
|
||||
printline!("Hello there!")
|
||||
println!("Hello there!")
|
||||
}
|
||||
|
||||
@ -3,11 +3,10 @@
|
||||
// Make me compile!
|
||||
//
|
||||
// Execute `rustlings hint variables1` or use the `hint` watch subcommand for a
|
||||
// hint.
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
|
||||
fn main() {
|
||||
x = 5;
|
||||
let x = 5;
|
||||
println!("x has the value {}", x);
|
||||
}
|
||||
|
||||
@ -3,10 +3,10 @@
|
||||
// Execute `rustlings hint variables2` or use the `hint` watch subcommand for a
|
||||
// hint.
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
|
||||
fn main() {
|
||||
let x;
|
||||
let x: i32 = 0;
|
||||
if x == 10 {
|
||||
println!("x is ten!");
|
||||
} else {
|
||||
|
||||
@ -3,9 +3,9 @@
|
||||
// Execute `rustlings hint variables3` or use the `hint` watch subcommand for a
|
||||
// hint.
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
|
||||
fn main() {
|
||||
let x: i32;
|
||||
let mut x: i32 = 3;
|
||||
println!("Number {}", x);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -3,10 +3,9 @@
|
||||
// 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 mut number: Result<u8, &str> = "T-H-R-E-E"; // don't change this line
|
||||
println!("Spell a Number : {}", number);
|
||||
number = 3; // don't rename this variable
|
||||
println!("Number plus two is : {}", number + 2);
|
||||
|
||||
@ -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: u32 = 3;
|
||||
fn main() {
|
||||
println!("Number {}", NUMBER);
|
||||
}
|
||||
|
||||
1
rustlings
Submodule
1
rustlings
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 9a743f80c57cc6bf27819589a8ddb5a5579ab1a4
|
||||
Loading…
x
Reference in New Issue
Block a user