[fpc-devel] Fwd: While - Otherwise Statement

Sven Barth pascaldragon at googlemail.com
Tue Oct 13 08:11:20 CEST 2015


Am 13.10.2015 03:34 schrieb "Flávio Etrusco" <flavio.etrusco at gmail.com>:
>
> On Mon, Oct 12, 2015 at 7:15 PM, David W Noon
> <david.w.noon at googlemail.com> wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > On Mon, 12 Oct 2015 15:11:18 -0400, Wkitty42 (wkitty42 at windstream.net)
> > wrote about "Re: [fpc-devel] Fwd: While - Otherwise Statement" (in
> > <561C05D6.4010403 at windstream.net>):
> >
> >> On 10/12/2015 02:02 PM, Dmitry Boyarintsev wrote:
> >>>
> >>> The next step would probably be controlled "break", where a user
> >>> would be able to specify how many nested loops needed to broken
> >>> from.
> >
> > Hi Mark,
> >
> > You might have seen me write things like this in the old OS2PROG echo
> > of Fidonet some 20+ years ago. ... :-)
> >
> > The only language I know that offers that level of control is PL/I,
> > where the break statement is coded as LEAVE.  It is handled by
> > labelling the loop control statement and coding the required label in
> > the LEAVE statement. For example:
> >
> >    loop_1: DO i = 1 TO m;
> >       loop_2 : DO j = 1 TO n;
> >          loop_3: DO k = 1 TO p;
> >            ...
> >            IF some_condition THEH
> >               LEAVE loop_3;[...]
>
> If I'm not missing something, Java implements 'break' just like this.
> I'd like such enhancement, but right now is there any reason to avoid
> 'goto' besides the bad karma?

The intrafunctional gotos not really. But the interfunctional ones
(modeswitch nonlocalgoto in 2.7.1+) might mess with managed types ;)

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20151013/2dd2f6f2/attachment.html>


More information about the fpc-devel mailing list