From 5064375ed7b3cd344c00fccdea5fdd3eb9de66cc Mon Sep 17 00:00:00 2001 From: Mingye Wang Date: Wed, 3 Oct 2018 12:55:54 -0400 Subject: [PATCH 1/2] remove redundant "else" test in temperature example Fix #450. There is also a spelling problem with "precede". --- Language/Structure/Control Structure/else.adoc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Language/Structure/Control Structure/else.adoc b/Language/Structure/Control Structure/else.adoc index 8ac37de85..66757eb1c 100644 --- a/Language/Structure/Control Structure/else.adoc +++ b/Language/Structure/Control Structure/else.adoc @@ -17,7 +17,7 @@ subCategories: [ "Control Structure" ] [float] === Description -The `if...else` allows greater control over the flow of code than the basic link:../if[if] statement, by allowing multiple tests to be grouped together. An `else` clause (if at all exists) will be executed if the condition in the `if` statement results in `false`. The `else` can proceed another `if` test, so that multiple, mutually exclusive tests can be run at the same time. +The `if...else` allows greater control over the flow of code than the basic link:../if[if] statement, by allowing multiple tests to be grouped together. An `else` clause (if at all exists) will be executed if the condition in the `if` statement results in `false`. The `else` can precede another `if` test, so that multiple, mutually exclusive tests can be run at the same time. [%hardbreaks] Each test will proceed to the next one until a true test is encountered. When a true test is found, its associated block of code is run, and the program then skips to the line following the entire if/else construction. If no test proves to be true, the default `else` block is executed, if one is present, and sets the default behavior. @@ -57,15 +57,15 @@ Below is an extract from a code for temperature sensor system ---- if (temperature >= 70) { - //Danger! Shut down the system + // Danger! Shut down the system } -else if (temperature >= 60 && temperature < 70) +else if (temperature >= 60) { - //Warning! User attention required + // Warning! Thorttle down, run the fans, and notify the user } else { - //Safe! Continue usual tasks... + // Safe! Continue usual tasks... } ---- @@ -84,4 +84,4 @@ else [role="language"] -- -// SEE ALSO SECTION ENDS \ No newline at end of file +// SEE ALSO SECTION ENDS From fa9ff4471f4bdaa8f15c39473ac8570c70dd9f80 Mon Sep 17 00:00:00 2001 From: Mingye Wang Date: Wed, 3 Oct 2018 20:03:11 -0400 Subject: [PATCH 2/2] else: (squash this) run a spillcheck --- Language/Structure/Control Structure/else.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Language/Structure/Control Structure/else.adoc b/Language/Structure/Control Structure/else.adoc index 66757eb1c..8d0477b99 100644 --- a/Language/Structure/Control Structure/else.adoc +++ b/Language/Structure/Control Structure/else.adoc @@ -61,7 +61,7 @@ if (temperature >= 70) } else if (temperature >= 60) { - // Warning! Thorttle down, run the fans, and notify the user + // Warning! Throttle down, run the fans, and notify the user } else {