We’ll translate the Go code to ActionScript and provide a suitable explanation in Markdown format, maintaining the overall structure and intent.
zeroptr in contrast has an Object parameter, meaning that it takes a reference to an object containing an int field. The iptr.value code in the function body then dereferences the pointer from its memory address to the current value at that address. Assigning a value to a dereferenced pointer changes the value at the referenced address.
The iPtr syntax gives us an object that acts like a pointer to i.
Pointers can be printed too.
In this example, zeroval doesn’t change the i in main, but zeroptr does because it has a reference to the memory address for that variable.