Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site watmum.UUCP Path: utzoo!watmath!watnot!watmum!cdshaw From: cdshaw@watmum.UUCP (Chris Shaw) Newsgroups: net.lang.c Subject: Re: Pascal question Message-ID: <65@watmum.UUCP> Date: Fri, 19-Apr-85 01:27:59 EST Article-I.D.: watmum.65 Posted: Fri Apr 19 01:27:59 1985 Date-Received: Sat, 20-Apr-85 01:42:36 EST References: <1617@ut-ngp.UUCP> <259@moncol.UUCP> Reply-To: cdshaw@watmum.UUCP (Chris Shaw) Organization: U of Waterloo, Ontario Lines: 50 Summary: Learn the damn language before pontificating !!! >> >>function p(var i:integer):integer; >> >>begin >> p := i; >> i := i+1; >>end (* p *); > >I don't have the original article handy, but it almost looks like someone >was trying to perform the illegal: > > function p(var i:integer):integer; > >which would be an attempt at declaring a function which returns two values. >I pray that somewhere there isn't a compiler which would accept that. >-- >Name: John Ruschmeyer You should hope no such thing !!!! If you find a Pascal compiler which won't accept this program fragment, THROW IT OUT, IT'S WRONG ! Many's the time I've written Pascal functions in the vein above. Quite simply, it is a very easy way to make functions which have error checking as in C. Thus: function x( var i : integer ) : boolean ; begin blah blah blah ; x := error status (success/fail); end; begin { main program } if( x( y ) )then play with y end. Is a much more natural and useful way of saying the same thing with procedures using multiple arguments. (And, yes I tested this, so I'm not just blabbering ) The upshot.. If you're going to talk about a language, learn it first ! Chris Shaw University of Waterloo