diff options
Diffstat (limited to 'source/lang/cpp/booleanvariables.rst')
-rw-r--r-- | source/lang/cpp/booleanvariables.rst | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/source/lang/cpp/booleanvariables.rst b/source/lang/cpp/booleanvariables.rst deleted file mode 100644 index e032c74..0000000 --- a/source/lang/cpp/booleanvariables.rst +++ /dev/null @@ -1,47 +0,0 @@ -.. highlight:: cpp - -.. _lang-booleanvariables: - -Booleans -======== - -A **boolean** holds one of two values, :ref:`true -<lang-constants-true>` or :ref:`false <lang-constants-false>`. On a -Maple, each boolean variable has type ``bool``. - -.. warning:: - - On an Arduino, the type ``boolean`` is also provided. While the - Maple also has this type for compatibility, **its use is strongly - discouraged**. The ``bool`` type is a standard part of C++, while - ``boolean`` is a non-standard extension that serves no purpose. - -Example -------- - -:: - - // running is a boolean variable: - bool running = false; - - void setup() { - pinMode(BOARD_LED_PIN, OUTPUT); - pinMode(BOARD_BUTTON_PIN, INPUT); - } - - void loop() { - if (isButtonPressed()) { - // button is pressed - running = !running; // toggle running variable - digitalWrite(BOARD_LED_PIN, running) // indicate via LED - } - } - -See Also --------- - -- :ref:`Boolean constants <lang-constants-bool>` -- :ref:`Boolean operators <lang-boolean>` -- :ref:`Variables <lang-variables>` - -.. include:: /arduino-cc-attribution.txt |