aboutsummaryrefslogtreecommitdiffstats
path: root/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
commit2d429e75ce69e77f8c95490ac03881ec9aa0354a (patch)
treea3b810a6c75625b07a4b976e5d1e319c60e19a6b /source/arduino/break.rst
parent30ac55d80c18e93f9c39a6dd850c10f9e7fd92ac (diff)
downloadlibrambutan-2d429e75ce69e77f8c95490ac03881ec9aa0354a.tar.gz
librambutan-2d429e75ce69e77f8c95490ac03881ec9aa0354a.zip
arduino language reference nearing completion, properly CC-BY-SA 3.0 attributed
Diffstat (limited to 'source/arduino/break.rst')
-rw-r--r--source/arduino/break.rst12
1 files changed, 8 insertions, 4 deletions
diff --git a/source/arduino/break.rst b/source/arduino/break.rst
index d951c52..57009c1 100644
--- a/source/arduino/break.rst
+++ b/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);