Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!bu-cs!dartvax!eleazar.dartmouth.edu!sean From: sean@eleazar.dartmouth.edu (Sean P. Nolan) Newsgroups: comp.lang.pascal Subject: Re: Funny evaluation of functions Keywords: functions, precedence Message-ID: <15195@dartvax.Dartmouth.EDU> Date: 23 Aug 89 19:21:11 GMT References: <614@lehi3b15.csee.Lehigh.EDU> Sender: news@dartvax.Dartmouth.EDU Reply-To: sean@eleazar.dartmouth.edu (Sean P. Nolan) Organization: Dartmouth College, Hanover, NH Lines: 15 I'm pretty sure that standard Pascal (and Turbo as well) evaluates expressions from right to left. That is, your function is invoked FIRST, which changes y, resulting in 5*5 as opposed to the "intuitive" 4*5 you intended. Somebody presented a theory to me as to why this was implemented this way, but I can't remember what it was and think it was stupid anyways. *grin* --- Sean +----------------------------------------------------------------------------+ | Sean P. Nolan | | "Let's face it: | | Dartmouth College | Net: Sean_Nolan@Mac.Dartmouth.EDU | IBM is no fun." | | Hinman Box 2658 | MCI Mail: snolan | :::::::::: | | Hanover, NH 03755 | | John C. Dvorak | +----------------------------------------------------------------------------+