Skip to main content

References

The video for “References” is in the works!

References allow functions to modify variables directly without copying.

Reference Parameters

Use ref to pass a variable by reference:

Try it yourself
Loading...

Swap Function

Try it yourself
Loading...

When to Use References

References are useful when you need to modify the original value, avoid copying large data, or return multiple values.

Try it yourself
Loading...

Previous: Interfaces | Next: Modules