Skip to content

Instantly share code, notes, and snippets.

@fal-works
Created July 16, 2020 12:41
Show Gist options
  • Save fal-works/96c36a418f01ab96331f29b5a33e7afd to your computer and use it in GitHub Desktop.
Save fal-works/96c36a418f01ab96331f29b5a33e7afd to your computer and use it in GitHub Desktop.
Haxe: Multiple Return Values
class Main {
static extern inline function swap(a, b)
return new Int2(b, a);
static function main() {
final input_a = 1974;
final input_b = 777;
final output = swap(input_a, input_b);
trace(output.a);
trace(output.b);
}
}
class Int2 {
public final a: Int;
public final b: Int;
public extern inline function new(a, b) {
this.a = a;
this.b = b;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment