Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!uunet!spool.mu.edu!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!dkuug!daimi!protonen From: protonen@daimi.aau.dk (Lars J|dal) Newsgroups: comp.lang.pascal Subject: Re: What's wrong with this: Message-ID: <1991May6.140715.15786@daimi.aau.dk> Date: 6 May 91 14:07:15 GMT References: <1991Apr20.011454.25016@javelin.sim.es.com> <1991May02.191410.23984@eve.wright.edu> Sender: protonen@daimi.aau.dk (Lars J|dal) Organization: DAIMI: Computer Science Department, Aarhus University, Denmark Lines: 33 cse4a004@eve.wright.edu (JOHN BLACKWELL) writes: >In article <1991Apr20.011454.25016@javelin.sim.es.com> tpehrson@javelin.sim.es.com writes: >> >>why doesn't this work: >> >>function upper(I:string):string; >> var z:integer; >> begin >> for z:=1 to length(I) do >> if (ord(I[z])>96) and (ord(I[z])<123) then I[z]:=upcase(I[z]); >> end; >> >Try a new header: > procedure upper(var I:string); >That should let you return changes to I. > -John Blackwell Correct, but if the guy really wants a function (so the argument doesn't have to be a variable) he could just as well keep the header as it is. Then he has forgotten to assign the function the return value, so the following line should be added at the end of the function: upper:=I; +--------------------------------------------------------------------------+ | Lars J|dal | (put your favourite quotation here) | | protonen@daimi.aau.dk | | |--------------------------------------------------------------------------| | Computer Science Department - Aarhus University - Aarhus - Denmark | +--------------------------------------------------------------------------+