comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam@spam.com>
Subject: Re: New to Ada, noticing something strange.
Date: Fri, 30 Sep 2005 06:28:14 GMT
Date: 2005-09-30T06:28:14+00:00	[thread overview]
Message-ID: <2W4%e.5303$oc.103@newsread2.news.pas.earthlink.net> (raw)
In-Reply-To: <1128038313.717692.268490@z14g2000cwz.googlegroups.com>

mike.martelli@gmail.com wrote:

> 			if not (Integer'Value(To_String(base)) > 1) or not
> (Integer'Value(To_String(base)) < 16) then

You might find "in" and "not in" (subtype membership operations) useful. The 
general form is

Value [not] in Subtype

"in" returns True if Value is a member of Subtype; "not in" if Value is not a 
member. This is defined for all types:

task type T (D : Integer);

subtype T1 is T (D => 1);

X : T (D => 7);

if X in T1 then -- True if X.D = 1

For a discrete type, the subtype may be given by a range:

if Integer'Value (To_String (Base) ) not in 1 .. 16 then

-- 
Jeff Carter
"There's no messiah here. There's a mess all right, but no messiah."
Monty Python's Life of Brian
84



  parent reply	other threads:[~2005-09-30  6:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-29 17:20 New to Ada, noticing something strange mike.martelli
2005-09-29 18:39 ` Jeffrey R. Carter
2005-09-29 19:05   ` mike.martelli
2005-09-29 22:25     ` Randy Brukardt
2005-09-29 23:58       ` mike.martelli
2005-09-30  0:28         ` mike.martelli
2005-09-30  6:06         ` Jeffrey R. Carter
2005-09-30  6:28         ` Jeffrey R. Carter [this message]
2005-09-30 10:19         ` Georg Bauhaus
2005-09-30 16:43           ` mike.martelli
2005-09-30  6:23     ` Jeffrey R. Carter
replies disabled

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