rayoko/examples/hello.ry
Luna 45275d73db change variable declarations to statements
doing them as expressions was a hack since no 'var' keyword,
also, yeet the := operator from the parser.
2019-09-25 22:22:13 -03:00

47 lines
568 B
Text

// import std;
fn f() i32 {
var a = 2;
return 2;
}
fn f2() i32 {
return f() + 2;
}
const (
piss = 1 + 3
)
enum B {
a
b
c
}
fn test_function() B {
return B.a;
}
fn multwo(num: i32, double_flag: bool) i32 {
// TODO resolve expr variables
if (true) {
return 1 * 2;
} else {
return 1;
}
}
fn add(a: i32, b: i32) i32 {
return 69 + 69;
}
fn and_fn() bool {
return true and false;
}
// type is void by default
//fn main() {
// print("piss\n");
// // print("2 + 2 = %d\n", add(1, 2));
//}