Skip to content

Instantly share code, notes, and snippets.

Created Apr 21, 2021
What would you like to do?
Haxe Rest Summation Example
import haxe.Rest;
function main() {
trace(sum(1, 2, 3));
trace(sum('Hello', ' World'));
function sum( {
var result = null;
for(element in rest) {
result = result == null ? element : result + element;
return result;
Copy link

KinoAR commented Apr 21, 2021

Haxe Rest Example

This illustrates some uses for rest that give a very JavaScript-like feel when building APIs.

You can see the example and run it here:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment