Merge pull request #6069 from raisedadead/fix/waypoint-logical-order-in-if-else-statements
Fixes the example code in the Waypoint: Logical Order in If Else Statementspull/6075/head
commit
635073ffb1
|
@ -2662,9 +2662,9 @@
|
|||
"The loop is executed from top to bottom so you will want to be careful of what statement comes first.",
|
||||
"Take these two functions as an example.",
|
||||
"Heres the first:",
|
||||
"<blockquote>function foo(x) {<br> if (x < 1) {<br> return \"Less than one\";<br> } else if (num < 2) {<br> return \"Less than two\";<br> } else {<br> return \"Greater than or equal to two\";<br> }<br>}</blockquote>",
|
||||
"<blockquote>function foo(x) {<br> if (x < 1) {<br> return \"Less than one\";<br> } else if (x < 2) {<br> return \"Less than two\";<br> } else {<br> return \"Greater than or equal to two\";<br> }<br>}</blockquote>",
|
||||
"And the second just switches the order of the statements:",
|
||||
"<blockquote>function bar(x) {<br> if (x < 2) {<br> return \"Less than two\";<br> } else if (num < 1) {<br> return \"Less than one\";<br> } else {<br> return \"Greater than or equal to two\";<br> }<br>}</blockquote>",
|
||||
"<blockquote>function bar(x) {<br> if (x < 2) {<br> return \"Less than two\";<br> } else if (x < 1) {<br> return \"Less than one\";<br> } else {<br> return \"Greater than or equal to two\";<br> }<br>}</blockquote>",
|
||||
"While these two functions look nearly identical if we pass a number to both we get different outputs.",
|
||||
"<blockquote>foo(0) // \"Less than one\"<br>bar(0) // \"Less than two\"</blockquote>",
|
||||
"<h4>Instructions</h4>",
|
||||
|
|
Loading…
Reference in New Issue