summaryrefslogtreecommitdiff
path: root/test/hello-world.hnshn
blob: 4d4af3dfa3ffe36be9c11662b3d8378dd2c40d0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const std = import('@std');

function main(): void {
  const integer: integer32 = 123;
  const string: string = '123';
  const array: [integer32][3] = [1, 2, 3];
  const map: [string][string|integer32] = [
    'first': 1,
    'second': 'two',
    'third': 3,
  ];

  for (array) |index, value| {
    // cool
  }

  for (map) |key, value| {
    // also cool
  }

  for (string) |index, char| {
    // cool?
    const char2 = std.str.get_char_at_index(string, index);
  }

  std.str.format('cool %s', string)
    |> print($);
}