[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-doc-bugs
Subject:    [DOC-BUGS] Doc #69099 [Com]: incomplete/ambiguous statement about continue
From:       "teo8976 at gmail dot com" <php-bugs () lists ! php ! net>
Date:       2015-02-22 0:44:51
Message-ID: 201502220044.t1M0ipP6029516 () sgrv20 ! php ! net
[Download RAW message or body]

Edit report at https://bugs.php.net/bug.php?id=69099&edit=1

 ID:                 69099
 Comment by:         teo8976 at gmail dot com
 Reported by:        teo8976 at gmail dot com
 Summary:            incomplete/ambiguous statement about continue
 Status:             Feedback
 Type:               Documentation Problem
 Package:            Documentation problem
 Operating System:   all
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

> Did you know you can submit patches to the documentation yourself? 

Yeah, I knew.
The problem is I'm not good at writing docs.

I thought reporting the issue would be better than nothing.


Previous Comments:
------------------------------------------------------------------------
[2015-02-22 00:29:43] requinix@php.net

Did you know you can submit patches to the documentation yourself? Since you have \
ideas on how to improve it, go ahead and suggest them: click Edit in the top right, \
log in (or stay anonymous), and edit the XML source of the documentation. When you're \
done, save and submit the change as a patch.

I'd suggest revising that paragraph a little to help with the language, and focusing \
on demonstrating the behavior of continue using an example or two.

If you do that then you can Close this ticket. Otherwise move this back to Open and \
someone else can.

------------------------------------------------------------------------
[2015-02-21 19:04:02] teo8976 at gmail dot com

Description:
------------
---
From manual page: http://www.php.net/control-structures.continue
---

"Note: Note that in PHP the switch statement is considered a looping structure for \
the purposes of continue."

It is completely unclear what that means, if it wasn't thanks to a user's comment. It \
does ring a bell that you have to be careful when using a continue statement inside a \
switch statement (where in most cases it won't do what you expect) but it doesn't \
explain even vaguely what the behavior is and hence what you are supposed to do to \
avoid unexpected behavior.

One may expect that "continue" in the context of a switch statement may jump to the \
next case, while it seems that it will effectively be equivalent to a break inside a \
switch.

The note should be expanded to be clearer, and a couple of examples should be added:
- one without any loop structure outside the switch statement containing the continue \
statement; with no argument to continue. Which would be only a theoretical example \
                where "continue" would be effectively equivalent to "break"
- one with a switch inside a for/while loop, first without any argument passed to \
continue, where the result is to only break the switch statement (most probably \
unwanted), and then with "continue 1" to obtain the (most probably wanted) effect of \
continuing the outside for loop.



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=69099&edit=1

-- 
PHP Documentation Bugs Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic