Skip to content

Commit

Permalink
add arr of structs
Browse files Browse the repository at this point in the history
  • Loading branch information
craigjson committed Oct 30, 2023
1 parent 613d1c9 commit 614d780
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions documentation/leo/03_language.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,14 @@ let arr: [bool; 4] = [true, false, true, false];
// Nested Array
let nested: [[bool; 2]; 2] = [[true, false], [true, false]];
// Array of Records
// Array of Structs
struct bar {
data: u8,
}
// Access the field of a Record within an Array
let arr_of_structs: [bar; 2] = [bar { data: 1u8 }, bar { data: 2u8 }];
// Access the field of a Struct within an Array
transition foo(a: [bar; 8]) -> u8 {
return a[0u8].data;
}
Expand Down

0 comments on commit 614d780

Please sign in to comment.