aboutsummaryrefslogtreecommitdiffstats
path: root/docs/source/lang/cpp/if.rst
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2011-06-10 09:10:03 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2011-06-10 09:10:03 -0400
commitdf044ee0c3a8602ac3329a86ff6c62d3ec4568b0 (patch)
tree100dcf093a7596c2632d4b944a46c5f3bd271a38 /docs/source/lang/cpp/if.rst
parent7374b7e9e264cd231f1e2bba44e776533938d41a (diff)
downloadlibrambutan-df044ee0c3a8602ac3329a86ff6c62d3ec4568b0.tar.gz
librambutan-df044ee0c3a8602ac3329a86ff6c62d3ec4568b0.zip
Docs: Use "BOARD_LED_PIN" instead of "13".
Fix examples where pin 13 was used explicitly instead of BOARD_LED_PIN. Also change an AVR-specific example in docs/lang/cpp/booleanvariables.rst to Maple conventions.
Diffstat (limited to 'docs/source/lang/cpp/if.rst')
-rw-r--r--docs/source/lang/cpp/if.rst14
1 files changed, 7 insertions, 7 deletions
diff --git a/docs/source/lang/cpp/if.rst b/docs/source/lang/cpp/if.rst
index d57b9f1..f248b05 100644
--- a/docs/source/lang/cpp/if.rst
+++ b/docs/source/lang/cpp/if.rst
@@ -43,28 +43,28 @@ conditional. If this is done, the next line (which ends in a
semicolon) becomes the only line in the body. The following three
``if`` statements all do the same thing::
- if (x > 120) digitalWrite(ledPin, HIGH);
+ if (x > 120) digitalWrite(pin, HIGH);
if (x > 120)
- digitalWrite(ledPin, HIGH);
+ digitalWrite(pin, HIGH);
if (x > 120) {
- digitalWrite(ledPin, HIGH);
+ digitalWrite(pin, HIGH);
}
However, the following two examples are different::
// example 1: two lines of code in the if body
if (x > 120) {
- digitalWrite(ledPin1, HIGH);
- digitalWrite(ledPin2, HIGH);
+ digitalWrite(pin1, HIGH);
+ digitalWrite(pin2, HIGH);
}
// example 2: one line of code in the if body, and
// another line of code after the if statement
if (x > 120)
- digitalWrite(ledPin1, HIGH); // this is in the if body
- digitalWrite(ledPin2, HIGH); // this is NOT in the if body
+ digitalWrite(pin1, HIGH); // this is in the if body
+ digitalWrite(pin2, HIGH); // this is NOT in the if body
In the first example, since the body is enclosed in curly braces, both
lines are included. In the second example, since the curly braces are