aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/test.cff
blob: d962b16b7f08bdd80d256ceced1ac75d1f51d193 (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
typedef v3f ["!"[~-1] - as(int)30.0]f32;

enum Color {
   Red = 7,
   Green = -10,
   Blue,
}

fn best() Color {
   return :Green;
}

fn hex(c Color) u32 {
   switch (c) {
   case :Red   do return 0xFF0000;
   case :Green do return 0x00FF00;
   case :Blue  do return 0x0000FF;
   }
}

extern fn main (argc int, argv **u8) void {
   extern fn printf(fmt *const u8, ...) int;

   printf("red %d\n", Color:Red);
   printf("green %d\n", Color:Green);
   printf("blue %d\n", Color:Blue);
   printf("red ! %.8X\n", hex(:Red));
   
   return;
}