Skip to content

Commit

Permalink
Merge pull request #166 from yushanfans2233/doc/array/rename
Browse files Browse the repository at this point in the history
docs(Array): rename array to numbers
  • Loading branch information
bobzhang authored Mar 24, 2024
2 parents 98c4489 + 1373f98 commit ae3d680
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,17 +348,17 @@ fn init {
An array is a finite sequence of values constructed using square brackets `[]`, with elements separated by commas `,`. For example:

```go
let array = [1, 2, 3, 4]
let numbers = [1, 2, 3, 4]
```

You can use `array[x]` to refer to the xth element. The index starts from zero.
You can use `numbers[x]` to refer to the xth element. The index starts from zero.

```go live
fn init {
let array = [1, 2, 3, 4]
let a = array[2]
array[3] = 5
let b = a + array[3]
let numbers = [1, 2, 3, 4]
let a = numbers[2]
numbers[3] = 5
let b = a + numbers[3]
print(b) // prints 8
}
```
Expand Down
12 changes: 6 additions & 6 deletions zh-docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,17 +351,17 @@ fn init {
数组是由方括号 `[]` 构造的有限值序列,其中元素由逗号 `,` 分隔。例如:

```rust
let array = [1, 2, 3, 4]
let numbers = [1, 2, 3, 4]
```

可以用 `array[x]` 来引用第 `x` 个元素。索引从零开始。
可以用 `numbers[x]` 来引用第 `x` 个元素。索引从零开始。

```rust live
fn init {
let array = [1, 2, 3, 4]
let a = array[2]
array[3] = 5
let b = a + array[3]
let numbers = [1, 2, 3, 4]
let a = numbers[2]
numbers[3] = 5
let b = a + numbers[3]
print(b) // 打印 8
}
```
Expand Down

0 comments on commit ae3d680

Please sign in to comment.