rayoko/examples/hello.ry

64 lines
761 B
Text
Raw Normal View History

const (
test_var = 1 + 3
)
2019-09-18 14:37:08 +00:00
fn f() i32 {
2019-09-27 20:18:38 +00:00
// var a = 3;
// return a;
return 2;
}
fn f2() i32 {
return f() + 2;
}
//fn f2() bool {
// return 1 > 10;
//}
enum B {
a
b
c
}
enum C {
blah
bluh
}
fn test_function() B {
return B.b;
}
fn func_refer_param(b: i32) i32 {
return b * 231 + b;
}
fn multwo(num: i32, double_flag: bool) i32 {
if (!double_flag) {
2019-09-28 20:58:17 +00:00
var value = 32;
return value;
}
if (double_flag) {
return num * 2;
} else {
return num;
}
}
fn add(a: i32, b: i32) i32 {
return a + b;
}
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));
//}