Skip to content

Instantly share code, notes, and snippets.

@aruld
Created October 19, 2011 17:19
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 aruld/1298983 to your computer and use it in GitHub Desktop.
Save aruld/1298983 to your computer and use it in GitHub Desktop.
Dart Functions
class FunctionTest {
FunctionTest(this.myFunc);
Function myFunc;
num run(num n) {
return myFunc(n);
}
}
main() {
var square = (aNumber) => aNumber * aNumber;
var result = new FunctionTest(square).run(5);
var squareRoot = (aNumber) {
print(aNumber);
return Math.sqrt(aNumber);
};
print(new FunctionTest(squareRoot).run(result));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment