Add test code
This commit is contained in:
32
test/functions.w12
Normal file
32
test/functions.w12
Normal file
@ -0,0 +1,32 @@
|
||||
fn mult3(a: int, b: int, c: int) -> int {
|
||||
return a * b * c;
|
||||
}
|
||||
|
||||
fn loop_test() -> int {
|
||||
var i: int = 0;
|
||||
var result: int = 0;
|
||||
|
||||
while i < 10 {
|
||||
printf("i = %d\n", i);
|
||||
result += i;
|
||||
i += 1;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
fn main() -> int {
|
||||
var a: int = 5;
|
||||
var b: int = 3;
|
||||
var c: int = 2;
|
||||
|
||||
var result: int = mult3(a, b, c);
|
||||
printf("Result: %d\n", result);
|
||||
|
||||
result = loop_test();
|
||||
printf("Result: %d\n", result);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user