Merge pull request #4726 from erictleung/fix/change-potential-confusion-on-conditionals

Fix example if-else statements with clearer example
This commit is contained in:
Logan Tegman
2015-11-26 00:09:56 -08:00

View File

@ -1143,10 +1143,11 @@
"We can use <code>if</code> statements in JavaScript to only execute code if a certain condition is met.",
"<code>if</code> statements require some sort of boolean condition to evaluate.",
"For example:",
"<code>if (1 === 2) {</code>",
"<code>&nbsp;&nbsp;return true;</code>",
"<code>var x = 1;</code>",
"<code>if (x === 2) {</code>",
"<code>&nbsp;&nbsp;return 'x is 2';</code>",
"<code>} else {</code>",
"<code>&nbsp;&nbsp;return false;</code>",
"<code>&nbsp;&nbsp;return 'x is not 2';</code>",
"<code>}</code>",
"Let's use <code>if</code> and <code>else</code> statements to make a coin-flip game.",
"Create <code>if</code> and <code>else</code> statements to return the string <code>\"heads\"</code> if the flip variable is zero, or else return the string <code>\"tails\"</code> if the flip variable is not zero."