compiler

Unnamed Compiled Systems Language Project
git clone http://frotz.net/git/compiler.git
Log | Files | Refs

1030-flow-control.src (444B)


      1 func hex(n i32) {
      2 	_hexout_(n);
      3 }
      4 
      5 func count(n i32) {
      6 	while (n > 0) {
      7 		hex(n);
      8 		if (n == 3) {
      9 			break;
     10 		}
     11 		n = n - 1;
     12 	}
     13 }
     14 
     15 func count_even(n i32) {
     16 	while (n > 0) {
     17 		n--;
     18 		if ((n & 1) == 1) {
     19 			continue;
     20 		}
     21 		_hexout_(n);
     22 	}
     23 }
     24 
     25 func start() i32 {
     26 	if (true) {
     27 		hex(0x10101010);
     28 	} else {
     29 		hex(0x20202020);
     30 	}
     31 
     32 	if (false) {
     33 		hex(0x30303030);
     34 	} else {
     35 		hex(0x40404040);
     36 	}
     37 
     38 	count(2);
     39 
     40 	count(7);
     41 
     42 	count_even(7);
     43 
     44 	return 1;
     45 }