## Declaring a reference
@``` decl1.gw
-ref Object object_ref;
+late Object object_ref;
<<< "Reference points to no object yet: ", object_ref >>>;
new Object @=> object_ref;
<<< "But now it does: ", object_ref >>>;
var int array[2][3];
var int i;
foreach(a: array) {
- foreach(ref b: a)
- <<< ++i => *b >>>;
+ foreach(b: a)
+ <<< ++i => b >>>;
}
foreach(a: array) {
- foreach(ref b: a)
- <<< *b >>>;
+ foreach(b: a)
+ <<< b >>>;
}
@```
@hide make -s forloop5.test
@``` repeat2.gw
repeat(3) {
- maybe ? "You" : "Me" => var string s;
+ maybe ? "You" : "Me" @=> var string s;
<<< "Hello, ", s, "!" >>>;
}
@```
For more infomations, see [here](https://en.wikipedia.org/wiki/Union_type).
@``` base_union
-union {
+union U {
int a;
float f;
Object o;