comp.lang.ada
 help / color / mirror / Atom feed
From: Matthias Teege <matthias@mteege.de>
Subject: raised CONSTRAINT_ERROR
Date: 2000/07/23
Date: 2000-07-23T00:00:00+00:00	[thread overview]
Message-ID: <86lmytp5i0.fsf@book.mteege.de> (raw)


Moin,

I made my first steps in Ada using GNATS under FreeBSD and
now I have a problem that I didnt understand. The followig
code gives me a raised CONSTRAINT_ERROR (in Line:
StrArg := Ada.Command_Line.Argument(I)) and I didnt know
why.

with Ada.Command_Line; use Ada.Command_Line;
with GNAT.IO; use GNAT.IO;

procedure Cldemo is

Argcount: Natural;
StrArg : String (1 .. 10);
I: Positive := 1;

begin
   Argcount := Ada.Command_Line.Argument_Count;

Schleife:
   while I <= Argcount loop
      StrArg := Ada.Command_Line.Argument(I);
      Put_Line(StrArg);
      I := I + 1;
   end loop Schleife;

end Cldemo;

If I change the Code to

with Ada.Command_Line; use Ada.Command_Line;
with GNAT.IO; use GNAT.IO;

procedure Cldemo is

Argcount: Natural;
I: Positive := 1;

begin
   Argcount := Ada.Command_Line.Argument_Count;

Schleife:
   while I <= Argcount loop
      Put_Line(Ada.Command_Line.Argument(I));
      I := I + 1;
   end loop Schleife;

end Cldemo;

all works perfect. What is the main difference between
both versions?

Thanks for any hints
Matthias





             reply	other threads:[~2000-07-23  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-07-23  0:00 Matthias Teege [this message]
2000-07-23  0:00 ` raised CONSTRAINT_ERROR Gisle S�lensminde
2000-07-24  0:00   ` Gisle S�lensminde
2000-07-24  0:00 ` Pascal Obry
2000-07-24  0:00 ` Ted Dennison
replies disabled

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