From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,7b668a769fbfcee0 X-Google-Attributes: gid103376,public From: Frode Tenneboe Subject: Re: array(enumeration) Date: 2000/07/20 Message-ID: <964097130.804601@edh3>#1/1 X-Deja-AN: 648589532 Cache-Post-Path: edh3!unknown@alne Content-Transfer-Encoding: 8bit References: Content-Type: text/plain; charset=ISO-8859-1 Organization: Ericsson Radar AS X-Cache: nntpcache 2.3.3 (see http://www.nntpcache.org/) Mime-Version: 1.0 User-Agent: tin/1.4.1-19991201 ("Polish") (UNIX) (SunOS/5.7 (sun4u)) Newsgroups: comp.lang.ada Date: 2000-07-20T00:00:00+00:00 List-Id: Mario Amado Alves wrote: : How do I define an array type indexed by an enumeration type? : type Array_Type is array(<>) of Some_Type; : -- /|\ : -- | : -- compiler says identifier expected here It is. You have to give the discrete type otherwise integer is assumed. Try: with Text_Io; procedure Enum is type Month is (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec); type Array_Type is array(Month range <>) of Integer; Spring : Array_Type(Mar..May) := (Mar => 31, Apr => 30, May =>31); begin Text_Io.Put_Line(Month'Image(Spring'First)& " has "& Integer'Image(Spring(Spring'First))& " days."); end Enum; : This makes sense to me, but does not compile. So how do I code the idea? Does this make more sense? -Frode -- ^ Frode Tenneb� | email: ft@edh.ericsson.se ^ | Ericsson Radar AS. N-1788 Halden | | | Phone: +47 69 21 41 47 | Frode@IRC | | with Standard.Disclaimer; use Standard.Disclaimer; |