| 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..5db2b357f3dc2eb8e16264d215f7c40221a88276
|
| --- /dev/null
|
| +++ b/src/tests/site/code/syntax.dart
|
| @@ -0,0 +1,23 @@
|
| +import 'dart:html'; // Dart supports libraries.
|
| +
|
| +// Define functions either inside or outside of classes.
|
| +startOrEndTest() {
|
| + // ...
|
| +}
|
| +
|
| +class Rectangle implements Shape { // Declaring a class...
|
| + final num height, width; // ...with properties.
|
| + num get area => height * width; // A property implemented with a getter.
|
| + // Also: function shorthand syntax (=>).
|
| + Rectangle(this.height, this.width); // Compact constructor syntax.
|
| +}
|
| +
|
| +// 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 {}
|
|
|