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

Side by Side Diff: src/site/_includes/language-tour/control-flow/index.markdown

Issue 10700168: massive CL is massive (Closed) Base URL: https://code.google.com/p/dartlang-site/@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 You can control the flow of your Dart code using any of the following: 1 You can control the flow of your Dart code using any of the following:
2 2
3 * [If and else](#if-else) 3 * [If and else](#if-else)
4 * [For loops](#for-loops) 4 * [For loops](#for-loops)
5 * [While and do while](#while) 5 * [While and do while](#while)
6 * [Break and continue](#break) 6 * [Break and continue](#break)
7 * [Switch and case](#switch) 7 * [Switch and case](#switch)
8 * [Assert](#assert) 8 * [Assert](#assert)
9 9
10 <h4 id="if-else">If and else</h4> 10 <h4 id="if-else">If and else</h4>
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 if a [boolean](#booleans) condition is false. 186 if a [boolean](#booleans) condition is false.
187 You can find examples of assert statements throughout this tour. 187 You can find examples of assert statements throughout this tour.
188 Here are some more: 188 Here are some more:
189 189
190 {% highlight dart %} 190 {% highlight dart %}
191 assert(text != null); // Make sure the variable has a non-null value. 191 assert(text != null); // Make sure the variable has a non-null value.
192 assert(number < 100); // Make sure the value is less than 100. 192 assert(number < 100); // Make sure the value is less than 100.
193 assert(urlString.startsWith('https')); // Make sure this is an HTTPS URL. 193 assert(urlString.startsWith('https')); // Make sure this is an HTTPS URL.
194 {% endhighlight %} 194 {% endhighlight %}
195 195
196 <aside class="note" markdown="1"> 196 <aside>
197 **Important:** Assert statements work only in checked mode. 197 <div class="alert alert-info">
198 They have no effect in production mode. 198 <strong>Tip:</strong>
199 Assert statements work only in checked mode.
200 They have no effect in production mode.
201 </div>
199 </aside> 202 </aside>
200 203
201 Inside the parentheses, you can put any expression 204 Inside the parentheses, you can put any expression
202 that resolves to a boolean value. 205 that resolves to a boolean value.
203 If the expression's value is true, 206 If the expression's value is true,
204 the assertion succeeds and execution continues. 207 the assertion succeeds and execution continues.
205 Otherwise, 208 Otherwise,
206 the assertion fails and an exception (an 209 the assertion fails and an exception (an
207 [AssertionError](http://api.dartlang.org/dart_core/AssertionError.html)) 210 [AssertionError](http://api.dartlang.org/dart_core/AssertionError.html))
208 is thrown. 211 is thrown.
OLDNEW
« no previous file with comments | « src/site/_includes/language-tour/classes/index.markdown ('k') | src/site/_includes/language-tour/generics/index.markdown » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698