Compare commits
No commits in common. "1e076842b6d1035300c0b5521a429ac57be92177" and "31c6314cf908b09d9bc375266322d124d20f9020" have entirely different histories.
1e076842b6
...
31c6314cf9
|
@ -6,7 +6,7 @@
|
|||
|
||||
// Fix the error below with least amount of modification to the code
|
||||
fn main() {
|
||||
let x: i32 = 5; // Uninitialized but used, ERROR !
|
||||
let x: i32; // Uninitialized but used, ERROR !
|
||||
let y: i32; // Uninitialized but also unused, only a Warning !
|
||||
|
||||
assert_eq!(x, 5);
|
||||
|
@ -19,8 +19,8 @@ fn main() {
|
|||
|
||||
// Fill the blanks in the code to make it compile
|
||||
fn main() {
|
||||
let mut x = 1;
|
||||
x += 2;
|
||||
let __ __ = 1;
|
||||
__ += 2;
|
||||
|
||||
assert_eq!(x, 3);
|
||||
println!("Success!");
|
||||
|
@ -40,7 +40,6 @@ fn main() {
|
|||
let y: i32 = 5;
|
||||
println!("The value of x is {} and value of y is {}", x, y);
|
||||
}
|
||||
let y: i32 = 5;
|
||||
println!("The value of x is {} and value of y is {}", x, y);
|
||||
}
|
||||
```
|
||||
|
@ -50,12 +49,11 @@ fn main() {
|
|||
|
||||
// Fix the error with the use of define_x
|
||||
fn main() {
|
||||
let x = define_x();
|
||||
println!("{}, world", x);
|
||||
println!("{}, world", x);
|
||||
}
|
||||
|
||||
fn define_x() -> String {
|
||||
String::from("hello")
|
||||
fn define_x() {
|
||||
let x = "hello";
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -23,9 +23,8 @@ This book was designed for easily diving into and get skilled with Rust, and it'
|
|||
|
||||
We use [mdbook](https://rust-lang.github.io/mdBook/) building our exercises. You can run locally with below steps:
|
||||
```shell
|
||||
$ git clone git@github.com:sunface/rust-by-practice.git
|
||||
$ cargo install mdbook
|
||||
$ cd rust-by-practice && mdbook serve en/
|
||||
$ cd rust-by-practice && mdbook serve
|
||||
```
|
||||
|
||||
## Features
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
我们使用 [mdbook](https://rust-lang.github.io/mdBook/) 构建在线练习题,你也可以下载到本地运行:
|
||||
```shell
|
||||
$ git clone git@github.com:sunface/rust-by-practice.git
|
||||
$ cargo install mdbook
|
||||
$ cd rust-by-practice && mdbook serve zh-CN/
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue