cvs: phpdoc /en/language control-structures.xml
| From: | Rasmus Lerdorf | Date: | Tue, 27 May 2003 14:21:55 +0000 |
| Subject: | cvs: phpdoc /en/language control-structures.xml | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969353940@lists.php.net to get a copy of this message | ||
rasmus Tue May 27 10:21:55 2003 EDT
Modified files:
/phpdoc/en/language control-structures.xml
Log:
Document the fact that continue applies to switch
Index: phpdoc/en/language/control-structures.xml
diff -u phpdoc/en/language/control-structures.xml:1.71
phpdoc/en/language/control-structures.xml:1.72
--- phpdoc/en/language/control-structures.xml:1.71 Wed May 21 18:37:51 2003
+++ phpdoc/en/language/control-structures.xml Tue May 27 10:21:55 2003
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.71 $ -->
+<!-- $Revision: 1.72 $ -->
<chapter id="control-structures">
<title>Control Structures</title>
@@ -679,6 +679,14 @@
skip the rest of the current loop iteration and continue execution
at the beginning of the next iteration.
</simpara>
+ <note>
+ <simpara>
+ Note that in PHP the
+ <link linkend="control-structures.switch">switch</link> statement is
+ considered a looping structure for the purposes of
+ <literal>continue</literal>.
+ </simpara>
+ </note>
<simpara>
<literal>continue</literal> accepts an optional numeric argument
which tells it how many levels of enclosing loops it should skip
@@ -724,6 +732,15 @@
on which value it equals to. This is exactly what the
<literal>switch</literal> statement is for.
</simpara>
+ <note>
+ <simpara>
+ Note that unlike some other languages, the
+ <link linkend="control-structures.continue">continue</link> statement
+ applies to switch and acts similar to <literal>break</literal>. If you
+ have a switch inside a loop and wish to continue to the next iteration of
+ the outer loop, use <literal>continue 2</literal>.
+ </simpara>
+ </note>
<para>
The following two examples are two different ways to write the
same thing, one using a series of <literal>if</literal>