From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: if-then-no-else Programming Date: Wed, 20 Apr 2016 16:07:24 -0700 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <1mlx1gf.ebrae11jak5tyN%csampson@inetworld.net> <1mlzbr3.1ivik7416ts9sjN%csampson@inetworld.net> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 20 Apr 2016 23:04:03 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="48b46be33beed75863f69afa437f956b"; logging-data="1716"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19FZuY3Kd80lPO4Kt6alLqFJGv0H0OvX0w=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0 In-Reply-To: <1mlzbr3.1ivik7416ts9sjN%csampson@inetworld.net> Cancel-Lock: sha1:IUyN5OV+NHvHvS6v9LaW7Te+GXM= Xref: news.eternal-september.org comp.lang.ada:30213 Date: 2016-04-20T16:07:24-07:00 List-Id: 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