Skip to content

Instantly share code, notes, and snippets.

@devboy
Created November 25, 2011 22:14
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 devboy/1394538 to your computer and use it in GitHub Desktop.
Save devboy/1394538 to your computer and use it in GitHub Desktop.
function doMath( x: Float, y: Float, operation: Float -> Float -> Float ) {
return operation( x, y );
}
function swapDivide( swap: Bool, x: Float, y: Float ) {
return swap ? y / x : x / y;
}
doMath( 10, 2, function(x, y) { return swapDivide(true, x, y); } ); // returns 0.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment