2019-09-25 20:17:47 +00:00
|
|
|
fn f() i32 {
|
2019-09-29 01:16:33 +00:00
|
|
|
var a = 3;
|
2019-09-29 01:48:59 +00:00
|
|
|
a = 2;
|
|
|
|
return a + 23;
|
2019-09-25 20:17:47 +00:00
|
|
|
}
|
|
|
|
|
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-28 16:17:11 +00:00
|
|
|
fn func_refer_param(b: i32) i32 {
|
|
|
|
return b * 231 + b;
|
|
|
|
}
|
|
|
|
|
2019-09-24 17:12:37 +00:00
|
|
|
fn multwo(num: i32, double_flag: bool) i32 {
|
2019-09-28 20:52:30 +00:00
|
|
|
if (!double_flag) {
|
2019-09-28 20:58:17 +00:00
|
|
|
var value = 32;
|
2019-09-28 20:52:30 +00:00
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
2019-09-28 01:36:35 +00:00
|
|
|
if (double_flag) {
|
|
|
|
return num * 2;
|
2019-09-24 17:12:37 +00:00
|
|
|
} else {
|
2019-09-28 01:36:35 +00:00
|
|
|
return num;
|
2019-09-24 17:12:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-24 16:32:00 +00:00
|
|
|
fn add(a: i32, b: i32) i32 {
|
2019-09-28 00:22:03 +00:00
|
|
|
return a + b;
|
2019-09-24 16:23:23 +00:00
|
|
|
}
|
|
|
|
|
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));
|
|
|
|
//}
|