Created
December 8, 2011 13:56
-
-
Save xitij2000/1447056 to your computer and use it in GitHub Desktop.
Dart code to print squares of first 10 numbers.
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
#import('dart:dom'); | |
class Example { | |
void run() { | |
HTMLDocument doc = window.document; | |
doc.write(square(10)); | |
} | |
List<int> square(int n) { | |
var result = new List<int>(); | |
for(int i = 0; i < n; i++) { | |
result.add(i * i); | |
} | |
return result; | |
} | |
} | |
void main() { | |
new Example().run(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment