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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,71c41b6f4d72158c X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-07-16 04:13:27 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!t-online.de!news-FFM2.ecrc.net!news.iks-jena.de!lutz From: lutz@iks-jena.de (Lutz Donnerhacke) Newsgroups: comp.lang.ada Subject: Re: if X in 1..35000 versus Boolean Date: Tue, 16 Jul 2002 11:13:26 +0000 (UTC) Organization: IKS GmbH Jena Message-ID: References: NNTP-Posting-Host: taranis.iks-jena.de X-Trace: branwen.iks-jena.de 1026818006 26581 217.17.192.37 (16 Jul 2002 11:13:26 GMT) X-Complaints-To: usenet@iks-jena.de NNTP-Posting-Date: Tue, 16 Jul 2002 11:13:26 +0000 (UTC) User-Agent: slrn/0.9.6.3 (Linux) Xref: archiver1.google.com comp.lang.ada:27144 Date: 2002-07-16T11:13:26+00:00 List-Id: * Jan Prazak wrote: >On Tue, 16 Jul 2002 07:18:54 -0100, Keith Thompson wrote: >> I think you're thinking of Pascal sets, not enumeration types. Ada >> doesn't have built-in set types, though they're easy enough to >> implement. >> >> If I recall correctly (it's been a while), in Pascal you can write >> something like: >> >> if X in [1 .. 4] then (* This is Pascal, not Ada *) begin >> ...; >> end; >> > > >Yes! That's exactly what I meant, but I gave it only another name. >Then I haven't misunderstood something, it just doesn't exist in Ada. with Ada.Text_IO; use Ada.Text_IO; procedure t is type Offset is range 0 .. 20; package NIO is new Ada.Text_IO.Integer_IO (Offset); use NIO; x : Offset; testfeld : array (Offset) of Boolean := (1..4 => True, others => False); begin Put ("Enter a number: "); Get (x); if testfeld (x) then Put_Line ("True"); else Put_Line ("False"); end if; end t;