Skip to content

Instantly share code, notes, and snippets.

@devboy
Created December 1, 2011 00:00
Show Gist options
  • Save devboy/1412061 to your computer and use it in GitHub Desktop.
Save devboy/1412061 to your computer and use it in GitHub Desktop.
var doMath = function( x: Int, y: Int, operation: Int->Int->Int )
{
return operation( x, y);
}
Lib.println( doMath( 10, 20, Funk.d( _ * _ ) ) ); // 200
//Lib.println( doMath( 10, 2, Funk.d( _ / _ ) ) ); // error because of int float issues
Lib.println( doMath( 10, 20, Funk.d( _ + _ ) ) ); // 30
Lib.println( doMath( 10, 20, Funk.d( _ - _ ) ) ); // -10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment