36 lines
566 B
Plaintext
36 lines
566 B
Plaintext
#import "modules/std.sx";
|
|
|
|
sum :: (args: ..s32) -> s32 {
|
|
result := 0;
|
|
for args {
|
|
result = result + it;
|
|
}
|
|
result;
|
|
}
|
|
|
|
print_all :: (args: ..s32) {
|
|
for args {
|
|
write(int_to_string(it));
|
|
write(" ");
|
|
}
|
|
write("\n");
|
|
}
|
|
|
|
main :: () -> s32 {
|
|
write(int_to_string(sum(10, 20, 30)));
|
|
write("\n");
|
|
|
|
print_all(1, 2, 3, 4, 5);
|
|
|
|
arr : [3]s32 = .[10, 20, 30];
|
|
write(int_to_string(sum(..arr)));
|
|
write("\n");
|
|
|
|
for arr {
|
|
write(int_to_string(it));
|
|
write(" ");
|
|
}
|
|
write("\n");
|
|
0;
|
|
}
|