Skip to content
This repository has been archived by the owner on Oct 17, 2023. It is now read-only.

Commit

Permalink
Merge pull request #140 from noir-lang/zepedro/dynamic_arrays
Browse files Browse the repository at this point in the history
Adding documentation for dynamic arrays
  • Loading branch information
signorecello authored May 5, 2023
2 parents 2d818e3 + 1f0dd05 commit 8d5ccfa
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/language_concepts/00_data_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,18 @@ fn main() {
All elements in an array must be of the same type (i.e. homogeneous). That is, an array cannot group
a `Field` value and a `u8` value together for example.

You can write mutable arrays, like:

```rust
fn main() {
let mut arr = [1, 2, 3, 4, 5];
assert(arr[0] == 1);

arr[0] = 42;
assert(arr[0] == 42);
}
```

#### Types

You can create arrays of primitive types or structs. There is not yet support for nested arrays
Expand Down
12 changes: 12 additions & 0 deletions versioned_docs/version-0.4.1/language_concepts/data_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,18 @@ fn main() {
All elements in an array must be of the same type (i.e. homogeneous). That is, an array cannot group
a `Field` value and a `u8` value together for example.

You can write mutable arrays, like:

```rust
fn main() {
let mut arr = [1, 2, 3, 4, 5];
constrain arr[0] == 1;

arr[0] = 42;
constrain arr[0] == 42;
}
```

#### Types

You can create arrays of primitive types or structs. There is not yet support for nested arrays
Expand Down

0 comments on commit 8d5ccfa

Please sign in to comment.