module Strings; import Out; const greeting = "hello"; var buf: [8]U8; proc count(xs: []const I64): I64; var i: INT; s: I64; begin s := 0; for i := 0 to LEN(xs) - 1 do s := s + xs[i]; end; return s; end; proc main*; var a: []const U8; b: [5]U8; c: [3]I64; d: [][]const U8; begin a := "hello"; if a = greeting then Out.str("eq "); end; if a # "help" then Out.str("ne "); end; if "abc" = "abc" then Out.str("lit "); end; b := "hello"; if b = a then Out.str("arr "); end; buf := "hi"; if buf[0..2] = "hi" then Out.str("buf "); end; Out.int(I64(buf[5])); Out.str(" "); Out.int(LEN(greeting)); Out.str(" "); Out.int(LEN(a[1..3])); Out.ln; c := [1, 2, 3]; Out.int(count(c)); Out.str(" "); Out.int(count([10, 20, 30, 40])); Out.str(" "); Out.int(count([])); Out.ln; d := ["one", "two", "three"]; Out.str(d[2]); Out.str(d[0]); Out.ln; Out.str("é\u{263A}\x41\n"); end; end Strings.