Created
October 19, 2011 17:19
-
-
Save aruld/1298983 to your computer and use it in GitHub Desktop.
Dart Functions
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 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