aboutsummaryrefslogtreecommitdiffstats
path: root/source/lang/while.rst
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@mit.edu>2010-11-29 01:49:26 -0500
committerMarti Bolivar <mbolivar@mit.edu>2010-11-29 01:49:26 -0500
commitee35f641687d0d3159c15eea5ad80d71efff4f82 (patch)
treed58e470a42623a1fba3eccbab324a26316d60398 /source/lang/while.rst
parentd9cbd78e29d42e70bb46641dd43ee0772c8c975f (diff)
downloadlibrambutan-ee35f641687d0d3159c15eea5ad80d71efff4f82.tar.gz
librambutan-ee35f641687d0d3159c15eea5ad80d71efff4f82.zip
Finished converting the Arduino docs
Diffstat (limited to 'source/lang/while.rst')
-rw-r--r--source/lang/while.rst41
1 files changed, 15 insertions, 26 deletions
diff --git a/source/lang/while.rst b/source/lang/while.rst
index be1ea14..9047d05 100644
--- a/source/lang/while.rst
+++ b/source/lang/while.rst
@@ -1,37 +1,28 @@
-.. _lang-while:
-
-while Loops
-===========
-
-Description
------------
-
-**while** loops will loop continuously, and infinitely, until the
-expression inside the parenthesis, () becomes false. Something must
-change the tested variable, or the **while** loop will never exit.
-This could be in your code, such as an incremented variable, or an
-external condition, such as testing a sensor.
+.. highlight:: cpp
+.. _lang-while:
+``while``
+=========
Syntax
------
::
- while(expression){
- // statement(s)
+ while (expression) {
+ // block of code
}
+Description
+-----------
-
-Parameters
-----------
-
-expression - a (boolean) C statement that evaluates to true or
-false
-
-
+``while`` loops will repeat the statements inside their associated
+block of code until the expression inside the parentheses becomes
+:ref:`false <lang-constants-false>`. Something must change the tested
+expressions' value, or the ``while`` loop will never exit. This could
+be in your code, such as an incremented variable, or an external
+condition, such as testing a sensor.
Example
-------
@@ -39,11 +30,9 @@ Example
::
var = 0;
- while(var < 200){
+ while(var < 200) {
// do something repetitive 200 times
var++;
}
-
-
.. include:: cc-attribution.txt