From 614d7806432aaf569dee24d3637119fbeab87fc3 Mon Sep 17 00:00:00 2001 From: craigjson-aleo Date: Mon, 30 Oct 2023 18:11:36 -0400 Subject: [PATCH] add arr of structs --- documentation/leo/03_language.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/documentation/leo/03_language.md b/documentation/leo/03_language.md index d69782f5e..5769db2cf 100644 --- a/documentation/leo/03_language.md +++ b/documentation/leo/03_language.md @@ -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; }