comp.lang.ada
 help / color / mirror / Atom feed
* raised CONSTRAINT_ERROR
@ 2000-07-23  0:00 Matthias Teege
  2000-07-23  0:00 ` Gisle S�lensminde
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Matthias Teege @ 2000-07-23  0:00 UTC (permalink / 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





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2000-07-24  0:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-07-23  0:00 raised CONSTRAINT_ERROR Matthias Teege
2000-07-23  0:00 ` Gisle S�lensminde
2000-07-24  0:00   ` Gisle S�lensminde
2000-07-24  0:00 ` Ted Dennison
2000-07-24  0:00 ` Pascal Obry

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