Skip to content

Instantly share code, notes, and snippets.

@anissen
Created June 18, 2015 11:57
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anissen/2b12ad2efb15050708d0 to your computer and use it in GitHub Desktop.
Save anissen/2b12ad2efb15050708d0 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