comp.lang.ada
 help / color / mirror / Atom feed
From: "Michael F. Yoder" <yoder@decada.zko.dec.com>
Subject: Re: GOTO in ADA
Date: 1999/08/19
Date: 1999-08-19T00:00:00+00:00	[thread overview]
Message-ID: <37BC2E9E.4D4EF69C@decada.zko.dec.com> (raw)
In-Reply-To: 6A08418D0DAA75E0.E4D1854DB5A80C85.B4B03E27B8C9304C@lp.airnews.net

Ray wrote:
> 
> I know that the use of GOTO statements are anathema to most diehard
> structured programmers, but can someone give an example of  a valid use
> of the GOTO in "real life" code?

If you are writing a dialog which asks many questions, and want to
re-ask one (e.g. because of an error), "goto Ask_Password;" is IMO
clearer than writing "loop... exit when Password_OK; end loop;" or
whatever.  This is particularly so in cases where a straightforward use
of loops would make them overlap, for example when the flow of control
looks like this:

      <ask Q1>
      ...
      <ask Q2>
      ...
      <if error, return to ask Q1>
      ...
      <if error, return to ask Q2>

-- 
Michael F. Yoder

Unscientific man is beset by a deplorable desire to have been right.
The scientist is distinguished by a desire to *be* right. -- W.V. Quine




  reply	other threads:[~1999-08-19  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-08-14  0:00 GOTO in ADA Ray
1999-08-19  0:00 ` Michael F. Yoder [this message]
1999-08-22  0:00   ` Robert Dewar
     [not found] <6A08418D0DAA75E0.E4D1854DB5A80C85.B4B03E27B8C9304C@lp.airnews. net>
1999-08-14  0:00 ` Matthew Heaney
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox