module RecordConst; import Out; type Act = (quit, focus, spawn); Rule = record cls: []const U8; tag: INT; float: BOOL; end; Key = record mods: U8; sym: U32; act: Act; arg: [8]U8; run: proc(n: INT); end; const Rules: [3]Rule = [{cls: "firefox", tag: 2}, {cls: "mpv", float: true}, {}]; Nums: [3]I64 = [10, 20, 30]; Lists: [2][]const I64 = [Nums, Nums]; Home: Rule = {cls: "home", tag: 7}; Grid: [2][2]U8 = [[1, 2], [3, 4]]; proc hello(n: INT); begin Out.str("hello "); Out.int(n); Out.ln; end; const Keys: [2]Key = [{mods: 4, sym: 113, act: quit, arg: "bye", run: hello}, {act: spawn, run: nil}]; proc main*; var i: INT; r: Rule; begin for i := 0 to LEN(Rules) - 1 do Out.str(Rules[i].cls); Out.str(" "); Out.int(Rules[i].tag); Out.str(" "); if Rules[i].float then Out.str("float"); end; Out.ln; end; Out.int(Lists[1][2]); Out.ln; r := Home; Out.str(r.cls); Out.int(Home.tag); Out.ln; Out.int(I64(Grid[1][0])); Out.ln; Out.str(Keys[0].arg[0..3]); Out.int(INT(Keys[0].sym)); Out.ln; Keys[0].run(5); if Keys[1].run = nil then Out.str("nil run"); Out.ln; end; end; end RecordConst.