mirror of
https://github.com/RustyRaptor/compilers.git
synced 2026-12-03 23:25:17 -07:00
43 lines
962 B
Plaintext
43 lines
962 B
Plaintext
extern func print_int (int) void;
|
|
extern func print_string (string) void;
|
|
extern func read_int () int;
|
|
|
|
package foo {
|
|
var y int = 7;
|
|
var Z int;
|
|
var A[100] int;
|
|
var x bool = true;
|
|
|
|
func dothis(a int, s bool) void {
|
|
if (a == 5) {
|
|
print_string("x is 5");
|
|
} else {
|
|
print_string("x is not 5");
|
|
}
|
|
}
|
|
|
|
func main () int
|
|
{
|
|
var x int;
|
|
print_string("hello, what is the meaning of life: ");
|
|
x = read_int();
|
|
print_string("The meaning of life is: ");
|
|
print_int(x);
|
|
|
|
x = 0;
|
|
while (x > 0) {
|
|
print_int(x);
|
|
x = x - 1;
|
|
}
|
|
|
|
x = x + 1 - 2 + 5;
|
|
|
|
dothis(5, true);
|
|
|
|
|
|
|
|
} // of main
|
|
|
|
} // of foo
|
|
|