didou Fri Nov 14 11:27:23 2003 EDT
Modified files: /phpdoc/en/language control-structures.xml Log: bugfixing #26209 Index: phpdoc/en/language/control-structures.xml diff -u phpdoc/en/language/control-structures.xml:1.81 phpdoc/en/language/control-structures.xml:1.82 --- phpdoc/en/language/control-structures.xml:1.81 Tue Sep 30 04:40:06 2003 +++ phpdoc/en/language/control-structures.xml Fri Nov 14 11:27:23 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.81 $ --> +<!-- $Revision: 1.82 $ --> <chapter id="control-structures"> <title>Control Structures</title> @@ -748,6 +748,49 @@ ?> ]]> </programlisting> + </informalexample> + </para> + <para> + Ommiting the semicolon after <literal>continue</literal> can lead to + confusion. Here's an example of what you shouldn't do. + </para> + <para> + <informalexample> + <programlisting role="php"> +<![CDATA[ +<?php + for ($i = 0; $i < 5; ++$i) { + if ($i == 2) + continue + print "$i\n"; + } +?> +]]> + </programlisting> + <para> + One can expect the result to be : + </para> + <screen> +<![CDATA[ +0 +1 +3 +4 +]]> + </screen> + <para> + but this script will output : + </para> + <screen> +<![CDATA[ +2 +]]> + </screen> + <para> + because the return value of the <function>print</function> + call is <literal>int(1)</literal>, and it will look like the + optional numeric argument mentionned above. + </para> </informalexample> </para> </sect1>