Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite about rust #49

Closed
fwqaaq opened this issue Nov 11, 2022 · 2 comments
Closed

Rewrite about rust #49

fwqaaq opened this issue Nov 11, 2022 · 2 comments

Comments

@fwqaaq
Copy link
Contributor

fwqaaq commented Nov 11, 2022

reference/docs/rust.md

Lines 780 to 815 in 72d3bd8

### 数组作为参数
```rust
fn main(){
let mut array: [i32 ; 5] = [1,2,3,4,6];
print_arrays(array);
println!("元素:{array:?}");
}
fn print_arrays(mut array:[i32; 5]) {
array[0] = 89;
array[1] = 90;
array[2] = 91;
array[3] = 92;
array[4] = 93;
println!("元素:{array:?}");
}
```
### 返回数组
```rust
fn main(){
let mut arr:[i32; 5] = [2,4,6,8,10];
multiply(arr);
println!("数组是:{:?}", multiply(arr));
}
fn multiply (mut arr: [i32 ; 5]) -> [i32 ; 5]{
arr[2] = 90;
for mut i in 0..5 {
arr[i] = arr[i] * arr[2];
}
return arr;
}
```
<!--rehype:className=wrap-text -->

@jaywcjlove 我想重新写一下 rust 文档,这部分感觉完全没有用,还有上面的流程控制,应该把模式匹配剥离出来

@jaywcjlove
Copy link
Owner

@jack-zhang-1314 可以的,重新优化排版布局

@jaywcjlove
Copy link
Owner

jaywcjlove commented Nov 22, 2022

#20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants