comp.lang.ada
 help / color / mirror / Atom feed
From: Marcus F <trenatos@gmail.com>
Subject: Re: Beginner issue..
Date: Sun, 16 Jun 2013 00:00:33 -0700 (PDT)
Date: 2013-06-16T00:00:33-07:00	[thread overview]
Message-ID: <93769622-5341-472e-8f08-c0121c38de5d@googlegroups.com> (raw)
In-Reply-To: <5788c60d-fb8c-4058-9ae9-414dd77a3dc4@googlegroups.com>

On Sunday, June 16, 2013 1:54:29 AM UTC-5, Marcus F wrote:
> Hi!
> 
> 
> 
> I'm Marcus, I'm completely new to ADA but not to programming.
> 
> I'm looking at a simple tutorial guide to pick up some basics of ADA, but I ran into an issue that I don't understand.
> 
> 
> 
> Here's the trivial example I followed:
> 
> 
> 
> with Ada.Text_IO, Ada.Integer_Text_IO;
> 
> use Ada.Text_IO, Ada.Integer_Text_IO;
> 
>  
> 
> procedure Compute is
> 
> 
> 
>  procedure Double(Item : in out Integer) is
> 
>  begin -- procedure Double.
> 
>    Item := Item * 2;
> 
>  end Double;
> 
> 
> 
>  X : Integer := 1;   -- Local variable X of type Integer.
> 
> 
> 
> begin -- procedure Compute
> 
>  loop
> 
>   Put(X);
> 
>   New_Line;
> 
>   Double(X);
> 
>  end loop;
> 
> end Compute;
> 
> 
> 
> 
> 
> Now, I expect X to double once per loop, but when I build and run, I just get 0's scrolling down my screen.
> 
> 
> 
> Could someone help out a newbie?

Let me rephrase that, I just removed the loop part, and the variable and Double seems fine, and displays the values I expect, but why would it just show a single line of 0's when in a loop?


  reply	other threads:[~2013-06-16  7:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-16  6:54 Beginner issue Marcus F
2013-06-16  7:00 ` Marcus F [this message]
2013-06-16  7:21   ` Dmitry A. Kazakov
2013-06-16  7:52     ` Marcus F
2013-06-16  7:55       ` Marcus F
2013-06-16  8:49         ` Dmitry A. Kazakov
2013-06-16 18:32           ` Marcus F
2013-06-16  7:30 ` Dirk Heinrichs
replies disabled

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