summaryrefslogtreecommitdiffstats
path: root/tests/main.jr
blob: 8d0d8286d61096ce39522de53e0f8cb837a2525f (plain) (blame)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// # current file: main.jr #

// this is a comment
/* this is also a comment */


enum colors
{
 blue,
 green,
 yellow
}

#import std.jr

struct string {
 value: string
  size : u64

  metadata: {
  score: s8
 }
}

bar(point: s32) int | ! {

 numbers: s32[5] = [1, 3, 5, 6]

  for x in numbers {
  if x == point {
   print(x)
  }
 }

 while true {
  point += 1
 }
}

main(x : s32, y: s32, z: s64) int | string {

 foo(4, 5);
 result: u64 = x + y + z
  return {4, "Hello World", 9}
}


baz(x: int) {

 switch x
 {
  case: {
   x = 1
  }

  case: {
   x -= 1
  }

  case: {
   x += 1
  }
 }
}

foo(x: s32, y: s32) ! {
 x += 5;
 return !;
}