From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: if-then-no-else Programming
Date: Wed, 20 Apr 2016 16:07:24 -0700
Date: 2016-04-20T16:07:24-07:00 [thread overview]
Message-ID: <nf91t1$1lk$1@dont-email.me> (raw)
In-Reply-To: <1mlzbr3.1ivik7416ts9sjN%csampson@inetworld.net>
On 04/20/2016 12:56 AM, Charles H. Sampson wrote:
>
> Don't hold me to this, but I have this vague memory that somewhere back
> at the beginning of Ada there was a proposal that every if-statement had
> to have an else-statement. I don't remember if it was one of the early
> incarnations of Ada, somebody's proposed coding style, on one of the
> non-green language proposals.
>
> The point was to indicate in the code that the possibility of the
> if-condition's being false had been considered.
I don't require it for a simple if statement, but I use the rule that an if with
an elsif must have an else. This shows that all alternatives have been
considered. If the else part is null, it provides a convenient place for the
comment explaining why no action is needed.
--
Jeff Carter
"[M]any were collected near them, ... to
enjoy the sight of a dead young lady, nay,
two dead young ladies, for it proved twice
as fine as the first report."
Persuasion
155
next prev parent reply other threads:[~2016-04-20 23:07 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-19 2:24 if-then-no-else Programming Charles H. Sampson
2016-04-19 3:08 ` Dennis Lee Bieber
2016-04-19 3:19 ` Jeffrey R. Carter
2016-04-19 6:18 ` Nasser M. Abbasi
2016-04-19 7:55 ` Dmitry A. Kazakov
2016-04-19 12:17 ` G.B.
2016-04-20 22:26 ` Martin
2016-04-19 13:27 ` gautier_niouzes
2016-04-19 19:51 ` Randy Brukardt
2016-04-19 22:40 ` Shark8
2016-04-20 22:35 ` Randy Brukardt
2016-04-20 7:56 ` Charles H. Sampson
2016-04-20 11:26 ` Dennis Lee Bieber
2016-04-20 12:32 ` G.B.
2016-04-20 12:36 ` G.B.
2016-04-20 23:07 ` Jeffrey R. Carter [this message]
2016-04-19 20:32 ` Charles H. Sampson
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox