comp.lang.ada
 help / color / mirror / Atom feed
* how to print position number of an enumeration variable?
@ 2001-09-30  1:09 mike
  2001-09-30  2:31 ` DuckE
  0 siblings, 1 reply; 8+ messages in thread
From: mike @ 2001-09-30  1:09 UTC (permalink / raw)


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




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

end of thread, other threads:[~2001-10-02 17:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-30  1:09 how to print position number of an enumeration variable? mike
2001-09-30  2:31 ` DuckE
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

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