fix variables

This commit is contained in:
holajiawei 2020-04-23 23:05:28 +08:00
parent 2ff3f7ae13
commit 8dd7400317
5 changed files with 9 additions and 11 deletions

View File

@ -6,9 +6,10 @@
// even after you already figured it out. If you got everything working and // even after you already figured it out. If you got everything working and
// feel ready for the next exercise, remove the `I AM NOT DONE` comment below. // feel ready for the next exercise, remove the `I AM NOT DONE` comment below.
// I AM NOT DONE
use std::u16;
fn main() { fn main() {
x = 5; let x:u16 = 5;
println!("x has the value {}", x); println!("x has the value {}", x);
} }

View File

@ -1,10 +1,10 @@
// variables2.rs // variables2.rs
// Make me compile! Execute the command `rustlings hint variables2` if you want a hint :) // Make me compile! Execute the command `rustlings hint variables2` if you want a hint :)
// I AM NOT DONE use std::u16;
fn main() { fn main() {
let x; let x:u16 = 0;
if x == 10 { if x == 10 {
println!("Ten!"); println!("Ten!");
} else { } else {

View File

@ -1,10 +1,9 @@
// variables3.rs // variables3.rs
// Make me compile! Execute the command `rustlings hint variables3` if you want a hint :) // Make me compile! Execute the command `rustlings hint variables3` if you want a hint :)
// I AM NOT DONE
fn main() { fn main() {
let x = 3; let mut x = 3;
println!("Number {}", x); println!("Number {}", x);
x = 5; x = 5;
println!("Number {}", x); println!("Number {}", x);

View File

@ -1,9 +1,8 @@
// variables4.rs // variables4.rs
// Make me compile! Execute the command `rustlings hint variables4` if you want a hint :) // Make me compile! Execute the command `rustlings hint variables4` if you want a hint :)
// I AM NOT DONE
fn main() { fn main() {
let x: i32; let x: i32 = 0;
println!("Number {}", x); println!("Number {}", x);
} }

View File

@ -1,11 +1,10 @@
// variables5.rs // variables5.rs
// Make me compile! Execute the command `rustlings hint variables5` if you want a hint :) // Make me compile! Execute the command `rustlings hint variables5` if you want a hint :)
// I AM NOT DONE
fn main() { fn main() {
let number = "3"; let mut number = "3";
println!("Number {}", number); println!("Number {}", number);
number = 3; number = "3";
println!("Number {}", number); println!("Number {}", number);
} }