Doc #69099 [Fbk->Opn]: incomplete/ambiguous statement about continue

From: Date: Sun, 22 Feb 2015 00:46:21 +0000
Subject: Doc #69099 [Fbk->Opn]: incomplete/ambiguous statement about continue
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-11967@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69099&edit=1 ID: 69099 User updated by: teo8976 at gmail dot com Reported by: teo8976 at gmail dot com Summary: incomplete/ambiguous statement about continue -Status: Feedback +Status: Open Type: Documentation Problem Package: Documentation problem Operating System: all PHP Version: Irrelevant Block user comment: N Private report: N New Comment: trying to set this to Open Previous Comments: ------------------------------------------------------------------------ [2015-02-22 00:44:51] teo8976 at gmail dot com > 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. ------------------------------------------------------------------------ [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

« previous php.doc.bugs (#11967) next »