From df044ee0c3a8602ac3329a86ff6c62d3ec4568b0 Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Fri, 10 Jun 2011 09:10:03 -0400 Subject: 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. --- docs/source/lang/cpp/if.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'docs/source/lang/cpp/if.rst') 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 -- cgit v1.2.3