program main enum Color variant Red variant Blue variant Green struct Pixel field x: i32 field label: string field color: Color fn make_pixels(head: string) -> (array Pixel 3) array Pixel construct Pixel field x int 1 field label var head field color enum-variant Color.Red construct Pixel field x int 2 field label string "mid" field color enum-variant Color.Blue construct Pixel field x int 3 field label string "tail" field color enum-variant Color.Green fn echo_pixels(pixels: (array Pixel 3)) -> (array Pixel 3) var pixels fn at(pixels: (array Pixel 3), i: i32) -> Pixel index var pixels var i fn first_label(head: string) -> string field-access label call at call make_pixels var head int 0 fn last_color(head: string) -> Color field-access color index call echo_pixels call make_pixels var head int 2 fn main() -> i32 match subject call last_color string "head" arm Color.Green int 0 arm Color.Red int 1 arm Color.Blue int 1 test "struct array string field access" binary = call first_label string "head" string "head" test "struct array nested enum field access" binary = call last_color string "head" enum-variant Color.Green test "struct array local param return call flow" binary = field-access x call at call echo_pixels call make_pixels string "sun" int 1 int 2