Fix void main
This commit is contained in:
parent
390a738f8e
commit
0d1e01abe1
@ -229,10 +229,11 @@ Modifications made to an array inside a function are visible outside the functio
|
||||
arr[2] = 42;
|
||||
}
|
||||
|
||||
void main() {
|
||||
int main() {
|
||||
int[5] arr;
|
||||
foo(arr);
|
||||
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.
|
||||
@ -241,11 +242,12 @@ While strings can be re-assigned (in contrast to arrays), this is not visible ou
|
||||
s = "foo";
|
||||
}
|
||||
|
||||
void main() {
|
||||
int main() {
|
||||
string s;
|
||||
s = "bar";
|
||||
foo(s);
|
||||
print(s); // outputs bar
|
||||
return 0;
|
||||
}
|
||||
|
||||
#### Type Conversion
|
||||
|
Loading…
Reference in New Issue
Block a user