Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Unified Diff: src/tests/site/code/syntax.dart

Issue 22528003: update examples on homepage (Closed) Base URL: https://github.com/dart-lang/dartlang.org.git@master
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/tests/site/code/syntax.dart
diff --git a/src/tests/site/code/syntax.dart b/src/tests/site/code/syntax.dart
new file mode 100644
index 0000000000000000000000000000000000000000..1ad08887d02e2ea795c6f57a24d676c9a11edb92
--- /dev/null
+++ b/src/tests/site/code/syntax.dart
@@ -0,0 +1,22 @@
+import 'dart:html'; // Dart supports libraries...
+
+class Rectangle implements Shape { // ...and classes.
+ final num height, width;
+ Rectangle(this.height, this.width); // Compact constructor syntax.
+ num perimeter() => 2*height + 2*width; // Function shorthand syntax.
sethladd 2013/08/08 05:06:29 should be a getter
Kathy Walrath 2013/08/08 17:09:38 Done.
+}
+
+// You can define functions either inside or outside of classes.
+startOrEndTest() {
+ // ...
+}
+
+// Every app has a main() function, where execution starts.
+main() {
+ // The cascade operator (..) saves you from repetitive typing.
+ query("#button")
+ ..text = "Run test"
+ ..onClick.listen(startOrEndTest);
+}
+
+class Shape {}

Powered by Google App Engine
This is Rietveld 408576698