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;
|
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
|
|||||||
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
|
||||||
|
Loading…
Reference in New Issue
Block a user