Skip to content

Commit

Permalink
Use proper lang in FAQ code block and add code excerpt (#3443)
Browse files Browse the repository at this point in the history
  • Loading branch information
parlough authored Aug 3, 2021
1 parent 9d1f86e commit 78526a7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
17 changes: 17 additions & 0 deletions examples/misc/test/faq.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import 'package:test/test.dart';

void main() {
test('make greeting', () {
// #docregion make-greeting
// Dart code

String makeGreeting(String name) {
var greeting = 'Hello $name';
return greeting;
}
// #enddocregion make-greeting

expect(makeGreeting('Dash'), equals('Hello Dash'));
expect(makeGreeting(''), equals('Hello '));
});
}
13 changes: 7 additions & 6 deletions src/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ Dart's are nicer syntactically.

Compare the following Closure compiler code:

{% prettify dart tag=pre+code %}
```js
// Closure compiler code

/**
Expand All @@ -303,21 +303,22 @@ Compare the following Closure compiler code:
*/
makeGreeting = function(name) {
/** @type {String} */
var greeting = 'hello ' + name;
var greeting = 'Hello ' + name;
return greeting;
}
{% endprettify %}
```

With the following Dart code:

{% prettify dart tag=pre+code %}
<?code-excerpt "misc/test/faq.dart (make-greeting)"?>
```dart
// Dart code
String makeGreeting(String name) {
var greeting = 'hello $name';
var greeting = 'Hello $name';
return greeting;
}
{% endprettify %}
```

### Q. How does Dart compare with CoffeeScript?

Expand Down

0 comments on commit 78526a7

Please sign in to comment.