-
-
Save zaxebo1/11f2b57989ba3e82481726d4214988b8 to your computer and use it in GitHub Desktop.
Haxe hxcpp cppia test
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
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 |
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 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