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,7d05ebe305483c33 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-12-24 13:21:18 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!news.tele.dk!small.news.tele.dk!212.74.64.35!colt.net!newspeer.clara.net!news.clara.net!news5-gui.server.ntli.net!ntli.net!news6-win.server.ntlworld.com.POSTED!not-for-mail From: "martin.m.dowie" Newsgroups: comp.lang.ada References: Subject: Re: Newbie question X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Message-ID: Date: Mon, 24 Dec 2001 21:13:22 -0000 NNTP-Posting-Host: 62.252.145.170 X-Complaints-To: abuse@ntlworld.com X-Trace: news6-win.server.ntlworld.com 1009228572 62.252.145.170 (Mon, 24 Dec 2001 21:16:12 GMT) NNTP-Posting-Date: Mon, 24 Dec 2001 21:16:12 GMT Organization: ntlworld News Service Xref: archiver1.google.com comp.lang.ada:18286 Date: 2001-12-24T21:13:22+00:00 List-Id: "Michal Nowak" wrote in message news:mailman.1009224122.1572.comp.lang.ada@ada.eu.org... > On 01-12-24 at 13:52 Jasbinder S Uppal wrote: > > Welcome newbie, from another newbie :-)) Ditto! [snipped problem] > Hour is of type Integer. It does not has to be predefined > Integer. You may do something like this: > type Hour_Type is range 0 .. 23; --this is declaration of > --integer type > Hour : Hour_Type; > However, if you declare Hour_Type as a distinct type, you will > have to cast result of Integer'Value to Hour_Type before assigning > it to Hour: > > Hour := Hour_Type (Integer'Value ( > Whole_Line(Current_Position .. Current'Position + 2) ) > ); > The bit about casting (in Ada usually called 'type converting') is a little over the top as Hour_Type has access to the attribute 'Value too. So it is a little simpler: Hour := Hour_Type'Value (Whole_Line (Current_Position .. Current_Position + 2));