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.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2acb7591d4833271 X-Google-Attributes: gid103376,public From: johnherro@aol.com Subject: Re: loop step function Date: 1997/01/27 Message-ID: <19970127125200.HAA26735@ladder01.news.aol.com>#1/1 X-Deja-AN: 212508590 references: organization: AOL http://www.aol.com newsgroups: comp.lang.ada x-admin: news@aol.com Date: 1997-01-27T00:00:00+00:00 List-Id: Perhaps there's also another reason that a STEP clause was deliberately omitted from Ada. In many languages, the index of the FOR loop has to be a numeric (integer in most languages, but in Basic it may also be a float). However, in Ada the index could be any discrete type, such as an enumeration type. It doesn't have to be numeric. Here's my favorite emumeration type: type CLA_Message_Type is (Ask_For _Help, Give_Help, Discuss_Ada, Please_Do_My_Homework, Flame, Flame_The_Flamer); Now in Ada you could write for L in Ask_For_Help .. Flame loop just as easily as you could write "for J in 1 .. 10 loop". It would make sense to allow a STEP 2 clause for J, because you could add 2 to J. But you certainly couldn't add 2 to L. No STEP clause would make sense for L. For consistency, Ada doesn't allow a STEP clause for any FOR loop, even if the index is numeric. The reason pointed out earlier, that incorrect loop termination is a frequent source of error, is certainly another valid reason why Ada deliberately omitted the STEP clause. - John Herro Software Innovations Technology http://members.aol.com/AdaTutor ftp://members.aol.com/AdaTutor