Document the fact that continue applies to switch

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@128912 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Rasmus Lerdorf 2003-05-27 14:21:55 +00:00
parent 2f74dbea17
commit 752196dc5a

View file

@ -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 @@ while (++$i) {
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 @@ while ($i++ < 5) {
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>