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 {} |