Path: utzoo!mnetor!uunet!husc6!hao!ames!umd5!brl-adm!adm!kirsch@braggvax.arpa From: kirsch@braggvax.arpa (David Kirschbaum) Newsgroups: comp.lang.pascal Subject: Re Turbo typed constants Message-ID: <10971@brl-adm.ARPA> Date: 22 Dec 87 23:16:43 GMT Sender: news@brl-adm.ARPA Lines: 43 (* >From: JOSH%ILJCT.BITNET@CNUCE-VM.arpa >To: info-pascal%brl.arpa.bitnet@wiscvm.wisc.edu > > How constant are TP 3.0?'s typed constants when declared in procedures or >functions? Are they like C's static variables, meaning that if I change such >a variable, the next time I call that procedure I will remain with that value? > Global peace depends on this one... > > Joshua Males > Plenty constant. Now if this were all it took to get global peace ... David Kirschbaum Toad Hall kirsch@braggvax.ARPA *) PROCEDURE Bogus1; CONST bc1 : INTEGER = 0; BEGIN Writeln('In a Procedure: local typed constant bc1 = ', bc1); bc1 := SUCC(bc1); END; FUNCTION bogus2 : INTEGER; CONST bc2 : INTEGER = 0; BEGIN Bogus2 := bc2; bc2 := SUCC(bc2); END; BEGIN Writeln('Demonstration of Turbo Pascal v3.0 "typed constants"'); Writeln('within procedures and functions.'); Writeln('Pause with ^S, Break with ^C.'); Repeat Bogus1; Writeln('Using a Function: local typed constant bc2 = ', bogus2); Until FALSE = TRUE; END.