From: "DuckE" <nospam_steved94@home.com>
Subject: Re: how to print position number of an enumeration variable?
Date: Sun, 30 Sep 2001 02:31:27 GMT
Date: 2001-09-30T02:31:27+00:00 [thread overview]
Message-ID: <3uvt7.55862$QK.36794657@news1.sttln1.wa.home.com> (raw)
In-Reply-To: 9p5rd30202n@drn.newsguy.com
Perhaps:
Put_Line( "the position number of the first enumeration element is " &
Integer'Image( Day_Type'Pos( Day_Type'First ) ) );
SteveD
"mike@athome" <mike_member@newsguy.com> wrote in message
news:9p5rd30202n@drn.newsguy.com...
> hello,
>
> suppose I have a variable of some enumeration type, and I want to
> print or find the position number in the enumeration type that this
> variable holds. How can do that?
>
> for example:
>
> -----------
> with Ada.Text_Io; use Ada.Text_Io;
>
> procedure Enum is
> type Day_type is (Monday, Tuesday, Wednesday, Thursday,
> Friday, Saturday, Sunday);
>
> Day Day_Type := Monday;
>
> begin
>
> Put_Line("the position number of first enumeration elemenet is " &
> Day_type'Image( ???? ) );
>
> end Enum;
>
> ---------------
>
> I know that the first enumeration literal will have a position of 0. But
> I just wanted to see if one can print this value. I looked at the
attributes
> of scalar data types, and do not see something like S'pos ?
>
> thanks,
> mike
>
next prev parent reply other threads:[~2001-09-30 2:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-09-30 1:09 how to print position number of an enumeration variable? mike
2001-09-30 2:31 ` DuckE [this message]
2001-09-30 5:37 ` mike
2001-09-30 6:27 ` James Rogers
2001-09-30 12:52 ` Robert Dewar
2001-10-02 17:49 ` Randy Brukardt
2001-09-30 12:50 ` Robert Dewar
2001-09-30 13:53 ` David Botton
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox