Multiple Return Values in GDScript
GDScript has built-in support for multiple return values. This feature is often used in idiomatic GDScript, for example, to return both result and error values from a function.
When you run this script, you’ll see the following output:
In GDScript, functions return a single value, but you can simulate multiple return values by returning an Array or Dictionary. When calling such functions, you can use array indexing to access individual values.
GDScript doesn’t have a built-in way to ignore certain return values (like Go’s blank identifier _
), but you can simply not assign those values if you don’t need them.
This approach allows for flexibility in returning and handling multiple values from functions in GDScript.