mirror of
https://github.com/sunface/rust-by-practice.git
synced 2025-08-11 22:14:47 +00:00
according to the idea of gtm-nayan #144, add println!("Success") for each exercise
This commit is contained in:
@@ -8,7 +8,9 @@
|
||||
fn main() {
|
||||
let x: i32; // uninitialized but using, ERROR !
|
||||
let y: i32; // uninitialized but also unusing, only warning
|
||||
println!("{} is equal to 5", x);
|
||||
|
||||
assert_eq!(x, 5);
|
||||
println!("Success!")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -20,7 +22,8 @@ fn main() {
|
||||
let __ = 1;
|
||||
__ += 2;
|
||||
|
||||
println!("{} is equal to 3", x);
|
||||
assert_eq!(x, 3);
|
||||
println!("Success!")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -90,6 +93,8 @@ fn main() {
|
||||
let y = 4;
|
||||
// shadowing
|
||||
let y = "I can also be bound to text!";
|
||||
|
||||
println!("Success!")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -124,6 +129,8 @@ fn main() {
|
||||
|
||||
assert_eq!(x, 3);
|
||||
assert_eq!(y, 2);
|
||||
|
||||
println!("Success!")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -142,6 +149,8 @@ fn main() {
|
||||
[.., y] = [1, 2];
|
||||
// fill the blank to make the code work
|
||||
assert_eq!([x,y], __);
|
||||
|
||||
println!("Success!")
|
||||
}
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user