Skip to content

Instantly share code, notes, and snippets.

@zaxebo1
Forked from anissen/MainTest.hx
Created September 4, 2022 22:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zaxebo1/11f2b57989ba3e82481726d4214988b8 to your computer and use it in GitHub Desktop.
Save zaxebo1/11f2b57989ba3e82481726d4214988b8 to your computer and use it in GitHub Desktop.
Haxe hxcpp cppia test
haxe -main MainTest -cpp test.cppia -D cppia
haxelib run hxcpp test.cppia
# Output:
# MainTest.hx:4: Hello world!
# MainTest.hx:5: Fibonacci of 7 is: 13
class MainTest {
static public function main() {
trace("Hello world!");
trace('Fibonacci of 7 is: ${fibonacci(7)}');
}
static function fibonacci(n) {
if (n == 0) return 0;
else if (n == 1) return 1;
return fibonacci(n - 1) + fibonacci(n - 2);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment