From 95783b750fda95f5f4c1fac00ab24da03b31b517 Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Mon, 25 Oct 2010 21:15:28 -0400 Subject: arduino language reference nearing completion, properly CC-BY-SA 3.0 attributed --- docs/source/arduino/break.rst | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'docs/source/arduino/break.rst') 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 `\ , +:ref:`for `\ , or :ref:`do/while ` loop, +bypassing the normal loop condition. It is also used to exit from a +:ref:`switch ` 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); -- cgit v1.2.3