update readme.md
This commit is contained in:
parent
f78840cd1f
commit
416427bfac
13
Readme.md
13
Readme.md
|
@ -1,5 +1,7 @@
|
|||
# Rust exercise
|
||||
> 中文 Readme [传送门](./zh-CN/Readme.md)。
|
||||
- English: [https://exercise.rs](https://exercise.rs)
|
||||
- 简体中文: [https://zh.exercise.rs](https://zh.exercise.rs)
|
||||
|
||||
|
||||
Greetings and welcome to `exercise.rs`, If you have the following problems:
|
||||
|
||||
|
@ -9,15 +11,12 @@ Greetings and welcome to `exercise.rs`, If you have the following problems:
|
|||
|
||||
Then you have come to a right place: here you can find a bunch of easy to hard exercises to improve your Rust skills which cover almost every topic in Rust,this will help you fill the gap of easy-to-learn and hard-to-use.
|
||||
|
||||
## Online Reading
|
||||
This book is written in English and Chinese, you can pick up the language you are familiar with:
|
||||
- English: [https://exercise.rs](https://exercise.rs)
|
||||
- 简体中文: [https://zh.exercise.rs](https://zh.exercise.rs)
|
||||
> 中文 Readme [传送门](./zh-CN/Readme.md)。
|
||||
|
||||
## About exercises
|
||||
- The only correct way: make exercise comipile with NO ERRORS!
|
||||
- You can edit exercise online and then run it online too
|
||||
- **Your only gola is make every exercise comipile with NO ERRORS!**
|
||||
- difficulty level: easy: 🌟 medium: 🌟🌟 hard: 🌟🌟🌟 hell: 🌟🌟🌟🌟
|
||||
- Everything is online: reading, editing, testing
|
||||
|
||||
|
||||
## Contributing
|
||||
|
|
|
@ -1 +1,59 @@
|
|||
# Statements and Expressions
|
||||
|
||||
### Examples
|
||||
```rust,editable
|
||||
fn main() {
|
||||
let x = 5u32;
|
||||
|
||||
let y = {
|
||||
let x_squared = x * x;
|
||||
let x_cube = x_squared * x;
|
||||
|
||||
// This expression will be assigned to `y`
|
||||
x_cube + x_squared + x
|
||||
};
|
||||
|
||||
let z = {
|
||||
// The semicolon suppresses this expression and `()` is assigned to `z`
|
||||
2 * x;
|
||||
};
|
||||
|
||||
println!("x is {:?}", x);
|
||||
println!("y is {:?}", y);
|
||||
println!("z is {:?}", z);
|
||||
}
|
||||
```
|
||||
|
||||
### Exercises
|
||||
🌟🌟
|
||||
```rust,editable
|
||||
// make it work with two ways: both modify the inner {}
|
||||
fn main() {
|
||||
let v = {
|
||||
let mut x = 1;
|
||||
x += 2
|
||||
};
|
||||
|
||||
assert_eq!(v, 3);
|
||||
}
|
||||
```
|
||||
|
||||
🌟
|
||||
```rust,editable
|
||||
|
||||
fn main() {
|
||||
let v = (let x = 3);
|
||||
|
||||
assert!(v == 3);
|
||||
}
|
||||
```
|
||||
|
||||
🌟
|
||||
```rust,editable
|
||||
|
||||
fn main() {}
|
||||
|
||||
fn sum(x: i32, y: i32) -> i32 {
|
||||
x + y;
|
||||
}
|
||||
```
|
|
@ -1,4 +1,7 @@
|
|||
# Rust 练习题
|
||||
- English: [https://exercise.rs](https://exercise.rs)
|
||||
- 简体中文: [https://zh.exercise.rs](https://zh.exercise.rs)
|
||||
|
||||
欢迎大家来到 `exercise.rs`,在来到这里之前不知道你有没有碰到过以下问题:
|
||||
|
||||
- 学完知识,想要针对性的练习,但是只能找到一些不痛不痒的习题
|
||||
|
@ -7,15 +10,10 @@
|
|||
|
||||
如果你曾经和我有一样的问题,那来到这里就对了:**在这里你能找到大量从简单到困难的 Rust 练习题,不仅能针对性巩固你所学过的知识,解决 Rust 语言难以上手应用的问题**。
|
||||
|
||||
## 在线阅读
|
||||
本书同时提供了中文和英文版本:
|
||||
- English: [https://exercise.rs](https://exercise.rs)
|
||||
- 简体中文: [https://zh.exercise.rs](https://zh.exercise.rs)
|
||||
|
||||
## 关于练习题的说明
|
||||
- 我们的练习只有一个目的:那就是让编译通过,但是你需要注意相应的提示,例如删除所有代码也可以让练习通过
|
||||
- 难度等级: 简单: 🌟 中等: 🌟🌟 困难: 🌟🌟🌟 地狱: 🌟🌟🌟🌟
|
||||
- 一切都在线化: 阅读、编辑和测试代码,当然还包括错误提示
|
||||
- 每一道练习题都只有一个目的:那就是让编译通过,但是你需要注意相应的提示,例如删除所有代码也可以让练习通过
|
||||
- 难度等级: 简单: 🌟 中等: 🌟🌟 困难: 🌟🌟🌟 地狱: 🌟🌟🌟🌟
|
||||
|
||||
## 欢迎你,贡献者
|
||||
本项目欢迎一切贡献者,特别是怀揣题库的兄弟,你所贡献的每一道题都会注明你的昵称和个人链接,是时候让全世界看看咱的风采了。
|
||||
|
|
|
@ -27,7 +27,7 @@ fn print_char(c : char) {
|
|||
}
|
||||
```
|
||||
|
||||
### Bool
|
||||
### 布尔
|
||||
🌟
|
||||
```rust, editable
|
||||
|
||||
|
@ -53,7 +53,7 @@ fn main() {
|
|||
```
|
||||
|
||||
|
||||
### Unit type
|
||||
### 单元类型
|
||||
🌟🌟
|
||||
```rust,editable
|
||||
|
||||
|
|
|
@ -1 +1,59 @@
|
|||
# Statements and Expressions
|
||||
|
||||
### Examples
|
||||
```rust,editable
|
||||
fn main() {
|
||||
let x = 5u32;
|
||||
|
||||
let y = {
|
||||
let x_squared = x * x;
|
||||
let x_cube = x_squared * x;
|
||||
|
||||
// This expression will be assigned to `y`
|
||||
x_cube + x_squared + x
|
||||
};
|
||||
|
||||
let z = {
|
||||
// The semicolon suppresses this expression and `()` is assigned to `z`
|
||||
2 * x;
|
||||
};
|
||||
|
||||
println!("x is {:?}", x);
|
||||
println!("y is {:?}", y);
|
||||
println!("z is {:?}", z);
|
||||
}
|
||||
```
|
||||
|
||||
### exercises
|
||||
🌟🌟
|
||||
```rust,editable
|
||||
// make it work with two ways: both modify the inner {}
|
||||
fn main() {
|
||||
let v = {
|
||||
let mut x = 1;
|
||||
x += 2
|
||||
};
|
||||
|
||||
assert_eq!(v, 3);
|
||||
}
|
||||
```
|
||||
|
||||
🌟
|
||||
```rust,editable
|
||||
|
||||
fn main() {
|
||||
let v = (let x = 3);
|
||||
|
||||
assert!(v == 3);
|
||||
}
|
||||
```
|
||||
|
||||
🌟
|
||||
```rust,editable
|
||||
|
||||
fn main() {}
|
||||
|
||||
fn sum(x: i32, y: i32) -> i32 {
|
||||
x + y;
|
||||
}
|
||||
```
|
Loading…
Reference in New Issue