comp.lang.ada
 help / color / mirror / Atom feed
From: "Josh Highley" <joshhighley@hotmail.com>
Subject: Re: non-consecutive ranges
Date: 1999/05/03
Date: 1999-05-03T19:31:17+00:00	[thread overview]
Message-ID: <372da27f.0@silver.truman.edu> (raw)
In-Reply-To: 7gct90$7hr$1@nnrp1.dejanews.com


<vlight@my-dejanews.com> wrote in message
news:7gct90$7hr$1@nnrp1.dejanews.com...
>
>
> is there a way to define a variable to have a non-consecutive range?  for
> instance, let's say i wanted to define variable X with a range from 2 to
1024
> and 4096 to 8192.
>
>   X : Integer range (1 .. 1024) and (4096 .. 8192);
>
> or something similar to this declaration.  in addition to define
> non-consecutive ranges, could i define a range of odd numbers? even
numbers?
>
> how would i go about declaring this?
>
> joe

How about this:

X             : integer range 2..8192;
X_hole     : integer range 1025..4096;
; other "holes" . . .

. . .

if an_integer not in X or else an_integer in X_hole then
    raise contraint_error;
end if;

. . .

; odd integers
if (an_integer not in X) or else (an_integer mod 2 = 0) then
    raise constrain_error;
end if;


Josh Highley
joshhighley@hotmail.com






      parent reply	other threads:[~1999-05-03  0:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-04-30  0:00 non-consecutive ranges vlight
1999-04-30  0:00 ` dennison
1999-04-30  0:00 ` Tucker Taft
1999-04-30  0:00   ` dennison
1999-05-01  0:00 ` Robert B. Love 
1999-05-04  0:00   ` fraser
1999-05-01  0:00 ` Ehud Lamm
1999-05-01  0:00   ` bglbv
1999-05-02  0:00     ` Ehud Lamm
1999-05-01  0:00 ` Robert Dewar
1999-05-01  0:00   ` dvdeug
1999-05-03  0:00 ` Josh Highley [this message]
replies disabled

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