On Fri, Dec 17, 2010 at 10:05 AM, [email protected] <
[email protected]> wrote:
> What PHP has implemented is "named break statements", as I understand it.
>
Not exactly. You can jump to arbitrary (labeled) lines within the same
context (method/function), but you cannot enter loop constructs--only exit
them. While the last bit implies they are only "named break statements," you
can use them outside of loops as a normal goto statement.
firingSequence:
if (!acquireTarget())
goto done;
fireMainCannon();
fireMissiles();
if (enemiesInView()):
goto firingSequence;
done:
The above implements a convoluted do...while loop using goto. Recommended?
Certainly not!
David