Merge pull request #218 from sweet2honey/master

match alphanumeric; fix array typo.
This commit is contained in:
Sunface 2022-04-20 08:36:40 +08:00 committed by GitHub
commit d820ecc19a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -80,7 +80,7 @@ fn main() {
// fill the blank with `matches!` to make the code work
for ab in alphabets {
assert!(matches!(ab, 'a'..='z' | 'A'..='Z' | '0' | '9'))
assert!(matches!(ab, 'a'..='z' | 'A'..='Z' | '0'..='9'))
}
}
```

View File

@ -1,5 +1,5 @@
# 数组
数组的类型是 `[T; Lengh]`, 就如你所看到的,数组的长度是类型签名的一部分,因此数组的长度必须在编译期就已知,例如你不能使用以下方式来声明一个数组:
数组的类型是 `[T; Length]`就如你所看到的,数组的长度是类型签名的一部分,因此数组的长度必须在编译期就已知,例如你不能使用以下方式来声明一个数组:
```rust
fn create_arr(n: i32) {
let arr = [1; n];