Advertisement
OCGer

Haxe optional arguments

May 23rd, 2016
1,259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Haxe 0.26 KB | None | 0 0
  1. static function test(?i:Int, ?s:String) {
  2.     trace(test()); // i: null, s: null
  3.     trace(test(1)); // i: 1, s: null
  4.     trace(test(1, "foo")); // i: 1, s: foo
  5.     trace(test("foo")); // i: null, s: foo
  6. }
  7. static public function main(){
  8.     trace(test());
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement