comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: loop variable
Date: Mon, 29 Sep 2008 10:52:08 +0200
Date: 2008-09-29T10:52:09+02:00	[thread overview]
Message-ID: <48e09739$0$6616$9b4e6d93@newsspool3.arcor-online.net> (raw)
In-Reply-To: <f1e0708f-da4a-4418-8fce-4ccab6bc5ec8@k30g2000hse.googlegroups.com>

george.priv@gmail.com schrieb:
> On Sep 28, 9:54 pm, jedivaughn <jedivaugh...@gmail.com> wrote:
>> What data_type is a loop variable
>> as an example
>> for i in 1..10
>> what data type is i?
>> and can I convert it to an integer?

As an alternative, don't convert a loop
variable to an integer if possible; instead,
consider what the loop variable is used for,
and whether the numbers you could be make
a numeric (sub)type of their own.

You can then use a technique such as the one
already mentioned ('Range) in another posting.

(Integer tends to invite many "evil" things
such as bound errors, lack of distinction between
numeric data, and more, and there is nothing
gained when using predefined Ada Integer
instead of your own problem's numeric types
:-)



  reply	other threads:[~2008-09-29  8:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-29  1:54 loop variable jedivaughn
2008-09-29  3:20 ` george.priv
2008-09-29  8:52   ` Georg Bauhaus [this message]
2008-09-29 10:38 ` Peter C. Chapin
2008-09-30  7:52   ` Jean-Pierre Rosen
2008-09-29 14:54 ` Adam Beneschan
replies disabled

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