aboutsummaryrefslogtreecommitdiffstats
path: root/docs/source/arduino/break.rst
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@mit.edu>2010-10-25 21:15:28 -0400
committerMarti Bolivar <mbolivar@mit.edu>2010-11-17 12:44:28 -0500
commit95783b750fda95f5f4c1fac00ab24da03b31b517 (patch)
tree2b0bf89c101aa58af5796fbe76c7ec98eebbb0a5 /docs/source/arduino/break.rst
parent3a9a119e9a8ce72c0e1b8fa4d3904bdf84ce355c (diff)
downloadlibrambutan-95783b750fda95f5f4c1fac00ab24da03b31b517.tar.gz
librambutan-95783b750fda95f5f4c1fac00ab24da03b31b517.zip
arduino language reference nearing completion, properly CC-BY-SA 3.0 attributed
Diffstat (limited to 'docs/source/arduino/break.rst')
-rw-r--r--docs/source/arduino/break.rst12
1 files changed, 8 insertions, 4 deletions
diff --git a/docs/source/arduino/break.rst b/docs/source/arduino/break.rst
index d951c52..57009c1 100644
--- a/docs/source/arduino/break.rst
+++ b/docs/source/arduino/break.rst
@@ -1,12 +1,14 @@
+.. highlight:: cpp
+
.. _arduino-break:
break
=====
-**break** is used to exit from a **do**, **for**, or **while**
-loop, bypassing the normal loop condition. It is also used to exit
-from a **switch** statement.
-
+``break`` is used to exit from a :ref:`while <arduino-while>`\ ,
+:ref:`for <arduino-for>`\ , or :ref:`do/while <arduino-dowhile>` loop,
+bypassing the normal loop condition. It is also used to exit from a
+:ref:`switch <arduino-switchcase>` statement.
Example
@@ -20,6 +22,8 @@ Example
sens = analogRead(sensorPin);
if (sens > threshold){ // bail out on sensor detect
x = 0;
+ // this line of code means that we'll immediately exit
+ // from the "for" loop:
break;
}
delay(50);