Created
July 16, 2020 12:41
-
-
Save fal-works/96c36a418f01ab96331f29b5a33e7afd to your computer and use it in GitHub Desktop.
Haxe: Multiple Return Values
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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