Fixed missing semicolons and spelling mistakes in basic-types functions

This commit is contained in:
Tanish-Eagle
2022-04-05 12:28:35 +05:30
parent e46c8aedb1
commit 53bd5941cd

View File

@ -3,13 +3,13 @@
```rust,editable
fn main() {
// don't modify the following two lines!
// Don't modify the following two lines!
let (x, y) = (1, 2);
let s = sum(x, y);
assert_eq!(s, 3);
println!("Success!")
println!("Success!");
}
fn sum(x, y: i32) {
@ -24,9 +24,9 @@ fn main() {
print();
}
// replace i32 with another type
// Replace i32 with another type
fn print() -> i32 {
println!("Success!")
println!("Success!");
}
```
@ -34,16 +34,16 @@ fn print() -> i32 {
3. 🌟🌟🌟
```rust,editable
// solve it in two ways
// Solve it in two ways
// DON'T let `println!` works
fn main() {
never_return();
println!("Failed!")
println!("Failed!");
}
fn never_return() -> ! {
// implement this function, don't modify the fn signatures
// Implement this function, don't modify the fn signatures
}
```
@ -90,11 +90,11 @@ fn main() {
// Diverging functions can also be used in match expression to replace a value of any value
false => {
println!("Success!");
panic!("we have no value for `false`, but we can panic")
panic!("we have no value for `false`, but we can panic");
}
};
println!("Excercise Failed if printing out this line!");
println!("Exercise Failed if printing out this line!");
}
```