Skip to content

Instantly share code, notes, and snippets.

@xitij2000
Created December 8, 2011 13:56
Show Gist options
  • Save xitij2000/1447056 to your computer and use it in GitHub Desktop.
Save xitij2000/1447056 to your computer and use it in GitHub Desktop.
Dart code to print squares of first 10 numbers.
#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