2019-09-26 03:11:48 +00:00
|
|
|
const (
|
|
|
|
test_var = 1 + 3
|
|
|
|
)
|
2019-09-18 14:37:08 +00:00
|
|
|
|
2019-09-25 20:17:47 +00:00
|
|
|
fn f() i32 {
|
2019-09-27 17:07:42 +00:00
|
|
|
var a = 3;
|
2019-09-27 16:49:53 +00:00
|
|
|
// return a;
|
2019-09-25 20:17:47 +00:00
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
2019-09-27 16:39:04 +00:00
|
|
|
fn f2() i32 {
|
2019-09-27 16:49:53 +00:00
|
|
|
return f() + 2;
|
2019-09-25 21:10:17 +00:00
|
|
|
}
|
|
|
|
|
2019-09-27 16:49:53 +00:00
|
|
|
//fn f2() bool {
|
|
|
|
// return 1 > 10;
|
|
|
|
//}
|
|
|
|
|
2019-09-25 14:29:47 +00:00
|
|
|
enum B {
|
|
|
|
a
|
|
|
|
b
|
|
|
|
c
|
2019-09-25 03:26:30 +00:00
|
|
|
}
|
|
|
|
|
2019-09-27 01:22:11 +00:00
|
|
|
enum C {
|
|
|
|
blah
|
|
|
|
bluh
|
|
|
|
}
|
|
|
|
|
2019-09-25 14:29:47 +00:00
|
|
|
fn test_function() B {
|
2019-09-27 01:27:05 +00:00
|
|
|
return B.b;
|
2019-09-25 03:26:30 +00:00
|
|
|
}
|
|
|
|
|
2019-09-24 17:12:37 +00:00
|
|
|
fn multwo(num: i32, double_flag: bool) i32 {
|
|
|
|
// TODO resolve expr variables
|
|
|
|
if (true) {
|
2019-09-27 17:07:42 +00:00
|
|
|
var truthy = true;
|
2019-09-24 17:12:37 +00:00
|
|
|
return 1 * 2;
|
|
|
|
} else {
|
2019-09-27 17:07:42 +00:00
|
|
|
var falsey = false;
|
2019-09-24 17:12:37 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-27 17:31:59 +00:00
|
|
|
fn multwo_with_one(b: i32) i32 {
|
2019-09-27 18:12:30 +00:00
|
|
|
return multwo(b, false) + b;
|
2019-09-27 17:31:59 +00:00
|
|
|
}
|
|
|
|
|
2019-09-24 16:32:00 +00:00
|
|
|
fn add(a: i32, b: i32) i32 {
|
2019-09-24 16:23:23 +00:00
|
|
|
return 69 + 69;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn and_fn() bool {
|
|
|
|
return true and false;
|
2019-09-18 14:37:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// type is void by default
|
2019-09-21 02:40:21 +00:00
|
|
|
//fn main() {
|
|
|
|
// print("piss\n");
|
|
|
|
// // print("2 + 2 = %d\n", add(1, 2));
|
|
|
|
//}
|