Index: src/site/articles/style-guide/index.markdown |
diff --git a/src/site/articles/style-guide/index.markdown b/src/site/articles/style-guide/index.markdown |
index 49c39db8a56ed51c56d98002048dfff2a7612d9c..43dc5a0c2fffb9f2220bc060b69cfc40b83f1d48 100644 |
--- a/src/site/articles/style-guide/index.markdown |
+++ b/src/site/articles/style-guide/index.markdown |
@@ -7,7 +7,7 @@ description: "Follow these guidelines for consistent, readable Dart code." |
has-permalinks: true |
article: |
written_on: 2011-10-27 |
- updated_on: 2014-10-27 |
+ updated_on: 2015-02-17 |
collection: everyday-dart |
--- |
@@ -18,7 +18,7 @@ article: |
<em>Written by Bob Nystrom<br /> |
<time pubdate date="2011-10-27">October 2011</time> |
-(updated October 2014) |
+(updated February 2015) |
</em> |
@@ -1503,3 +1503,27 @@ var fooList = [1, 2, |
3, 4]; |
{% endprettify %} |
</div> |
+ |
+ |
+## Strings |
+ |
+#### AVOID using curly braces in interpolation when not needed. |
+{:.no_toc} |
+ |
+If you're just interpolating a simple identifier that's not immediately |
+followed by more alphanumeric text, the `{}` can and should be omitted. |
+ |
+<div class="good"> |
+{% prettify dart %} |
+'Hi, $name!' |
+"Wear your wildest $decade's outfit." |
+'Wear your wildest ${decade}s outfit.' |
+{% endprettify %} |
+</div> |
+ |
+<div class="bad"> |
+{% prettify dart %} |
+'Hi, ${name}!' |
+"Wear your wildest ${decade}'s outfit." |
+{% endprettify %} |
+</div> |