Commit 0d1e01ab authored by Alexander Hirsch's avatar Alexander Hirsch
Browse files

Fix void main

parent 390a738f
...@@ -229,10 +229,11 @@ Modifications made to an array inside a function are visible outside the functio ...@@ -229,10 +229,11 @@ Modifications made to an array inside a function are visible outside the functio
arr[2] = 42; arr[2] = 42;
} }
void main() { int main() {
int[5] arr; int[5] arr;
foo(arr); foo(arr);
print_int(arr[2]); // outputs 42 print_int(arr[2]); // outputs 42
return 0;
} }
While strings can be re-assigned (in contrast to arrays), this is not visible outside the function call. While strings can be re-assigned (in contrast to arrays), this is not visible outside the function call.
...@@ -241,11 +242,12 @@ While strings can be re-assigned (in contrast to arrays), this is not visible ou ...@@ -241,11 +242,12 @@ While strings can be re-assigned (in contrast to arrays), this is not visible ou
s = "foo"; s = "foo";
} }
void main() { int main() {
string s; string s;
s = "bar"; s = "bar";
foo(s); foo(s);
print(s); // outputs bar print(s); // outputs bar
return 0;
} }
#### Type Conversion #### Type Conversion
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment