comp.lang.ada
 help / color / mirror / Atom feed
From: Austin Obyrne <austin.obyrne@hotmail.com>
Subject: Re: Help with an errant 'IF' statement please.
Date: Sat, 29 Nov 2014 07:05:09 -0800 (PST)
Date: 2014-11-29T07:05:09-08:00	[thread overview]
Message-ID: <0a70a8a3-45fc-440b-999b-f9cfbc6ac7f9@googlegroups.com> (raw)
In-Reply-To: <d1945ff6-c57d-44be-bd14-b6c311d78ef0@googlegroups.com>

On Saturday, November 29, 2014 2:03:26 PM UTC, gautier...@hotmail.com wrote:
> Le samedi 29 novembre 2014 14:28:40 UTC+1, Austin Obyrne a écrit :
> 
> > This is an IF statement that just won't work and the same has happened in the past on other occasions in this very same program alone while working ok in other parts of the same program further on as well as being ok in other loops. 
> 
> Since Total doesn't change during the loop, the condition is either always True or always False. The IF works as always, but perhaps not in the way you expect... I guess you copy-pasted the IF statement from elsewhere, but then you should have "Line_Number" instead of "Total" to have a stop every 12 output lines.
> _________________________ 
> Gautier's Ada programming 
> http://gautiersblog.blogspot.com/search/label/Ada 
> NB: follow the above link for a valid e-mail address

I beg your pardon.

Total should not be there - it remained from my last experiment.

This is what I should have posted :-

Start here|:

Line_Number : Integer;  

Sentinel : CONSTANT Character:= '~';

Line_Number:= 0;
  
LOOP
  EXIT WHEN NextChar = Sentinel;
 
  Line_Number:= Line_Number+1;
  Ada.Text_IO.New_Line(1);
  Ada.Text_IO.Put(Item => "                          - Character number ");
  Ada.Integer_Text_IO.Put(Item => Line_Number, Width => 1);
  Ada.Text_IO.New_Line(1);
   
 
    IF Line_Number REM 12 = 0 THEN
      Ada.Text_IO.New_Line(1);
      Ada.Text_IO.Put(Item => "                       ");
      Ada.Text_IO.Put(Item => " # - press any key/return to continue > ");
      Ada.Text_IO.Get(Item => View);
    END IF;

  Ada.Text_IO.New_Line;
  Ada.Text_IO.Put(Item => "  ----------------------------------------------------------------");
  END LOOP;

Sorry for confusing matters, please continue if you will - Austin

  reply	other threads:[~2014-11-29 15:05 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-29 13:28 Help with an errant 'IF' statement please Austin Obyrne
2014-11-29 14:03 ` gautier_niouzes
2014-11-29 15:05   ` Austin Obyrne [this message]
2014-11-29 15:45     ` Simon Clubley
2014-11-29 16:10       ` Austin Obyrne
2014-11-29 16:54     ` Dennis Lee Bieber
2014-11-30  2:16       ` Austin Obyrne
2014-11-30 11:18         ` Simon Clubley
2014-11-30 12:58           ` Austin Obyrne
2014-11-30 13:01             ` Austin Obyrne
2014-12-01 22:20               ` Stephen Leake
2014-12-02  2:57                 ` Austin Obyrne
2014-11-30 13:46             ` Simon Clubley
2014-11-30 14:49               ` Austin Obyrne
2014-11-30 15:43                 ` Simon Clubley
2014-11-30 19:23                 ` Shark8
2014-11-30 11:56         ` Denis McMahon
2014-11-30 12:19           ` Austin Obyrne
2014-11-29 14:08 ` Simon Clubley
replies disabled

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