Fix example if-else statements with clearer example
This commit is contained in:
@ -1143,10 +1143,11 @@
|
|||||||
"We can use <code>if</code> statements in JavaScript to only execute code if a certain condition is met.",
|
"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.",
|
"<code>if</code> statements require some sort of boolean condition to evaluate.",
|
||||||
"For example:",
|
"For example:",
|
||||||
"<code>if (1 === 2) {</code>",
|
"<code>var x = 1;</code>",
|
||||||
"<code> return true;</code>",
|
"<code>if (x === 2) {</code>",
|
||||||
|
"<code> return 'x is 2';</code>",
|
||||||
"<code>} else {</code>",
|
"<code>} else {</code>",
|
||||||
"<code> return false;</code>",
|
"<code> return 'x is not 2';</code>",
|
||||||
"<code>}</code>",
|
"<code>}</code>",
|
||||||
"Let's use <code>if</code> and <code>else</code> statements to make a coin-flip game.",
|
"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."
|
"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."
|
||||||
|
Reference in New Issue
Block a user