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

Unified Diff: src/site/_includes/language-tour/3-built-in-types/booleans.html

Issue 10788006: new site (Closed) Base URL: https://code.google.com/p/dartlang-site/@master
Patch Set: final patch Created 8 years, 5 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/site/_includes/language-tour/3-built-in-types/booleans.html
diff --git a/src/site/_includes/language-tour/3-built-in-types/booleans.html b/src/site/_includes/language-tour/3-built-in-types/booleans.html
index f7a0023442844bb11182a9588c24def2741a329b..858412cc32a4b1dcf57f88a51e127b1ac611b6a4 100644
--- a/src/site/_includes/language-tour/3-built-in-types/booleans.html
+++ b/src/site/_includes/language-tour/3-built-in-types/booleans.html
@@ -26,12 +26,19 @@ if (name) {
<p>
In JavaScript, this code prints "You have a name!" because
<code>name</code> is a non-null object.
-However, in Dart, the above doesn't print at all
+However, in Dart <strong>running in production mode</strong>,
+the above doesn't print at all
because <code>name</code> is converted to <b>false</b>
because <code>name != true</code>.
</p>
<p>
+In Dart <strong>running in checked mode</strong>, the above code
+will throw an exception because the <code>name</code>
+variable is not a boolean.
+</p>
+
+<p>
Here's another example of code
that behaves differently in JavaScript and Dart:
</p>
@@ -40,14 +47,21 @@ that behaves differently in JavaScript and Dart:
if (1) {
print("JavaScript prints this line because it thinks 1 is true.");
} else {
- print("Dart prints this line because it thinks 1 is NOT true.");
+ print("Dart in production mode prints this line.");
+
+ // However, in checked mode, if (1) will throw an exception
+ // because 1 is not a boolean.
}
{% endhighlight %}
-<br>
-<aside class="note">
-<b>Note:</b>
-The previous two samples work only in production mode, not checked mode.
+
+<aside>
+ <div class="alert alert-info">
+ <strong>Tip:</strong>
+ The previous two samples work only in production mode, not checked mode.
+ In checked mode, an exception is thrown if a non-boolean is used
+ when a boolean is expected.
+ </div>
</aside>
<p>
@@ -86,5 +100,3 @@ because we haven't discussed operators yet.
We should be sure to cover this in the operator section!}
{QUESTION: Is this covered? If so, should we point to it from here?}
{% endcomment %}
-
-</section>

Powered by Google App Engine
This is Rietveld 408576698