Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!samsung!crackers!m2c!umvlsi!dime!smectos!eli From: eli@smectos.gang.umass.edu (Eli Brandt) Newsgroups: comp.lang.pascal Subject: Re: Fields on the screen for a DataBase Message-ID: <24072@dime.cs.umass.edu> Date: 14 Dec 90 20:54:07 GMT References: <259.275a4a92@zodiac.rutgers.edu> <95@bart.cs.mcgill.ca> Sender: news@dime.cs.umass.edu Reply-To: eli@smectos.CS.UMASS.EDU (Eli Brandt) Organization: University of Massachusetts, Amherst Lines: 19 In article <95@bart.cs.mcgill.ca> einstein@quiche.cs.mcgill.ca (Michael CHOWET) writes: >In article <259.275a4a92@zodiac.rutgers.edu> mshah@zodiac.rutgers.edu writes: > [discussion of fields stored in array deleted] > Now comes something a little tricky for beginners to Pascal. How do you >jump from the last field to the first? You could use an IF, but that isn't >elegant, and would probably go slower (but hey, who'd notice on a >Cray, anyways?? :-). Instead, have you incrementer make use of a mod >statement. The use would be something like > Point := ( Point + 1 ) Mod Number_Of_Fields ; > > You will probably need an if for a decrement, though. > One problem with using _mod_ here is that it's slower than _if_. Relative elegance is, I suppose, a matter of taste. When you use _if_ it's a little clearer what you're trying to do, though.