Just discovered something kinda cool that I want to share:

Here are a set of equates:

COM.DEFS TEST.FILE
001:    DIM TEF(2)
002: *
003:    EQU TEF.VAL         TO TEF(1)
004:    EQU TEF.TOTAL.VAL   TO SUM(TEF.VAL)
005: *

And here is a little test program:

0001: *
0002:     INCLUDE COM.DEFS TEST.FILE
0003: 10  MAT TEF=""
0004:     FOR I=1 TO 5
0005:        TEF.VAL<1,I>=RND(20)
0006:        PRINT "VALUE ":I:" = ":TEF.VAL<1,I>"R#2"
0007:     NEXT I
0008:     PRINT "        ----"
0009:     PRINT "TOTAL  = ":TEF.TOTAL.VAL"R#3"
0010:     PRINT "SUM    = ":SUM(TEF.VAL)"R#3"
0011:     PRINT STR("-",78)
0012:     PRINT "RETURN to do it again or 'E'xit ": ; INPUT B,1
0013:     IF UPCASE(B)="E" THEN STOP ELSE GO 10
0014:  END

When you run this, the variable "TEF.TOTAL.VAL" always "knows" the sum of the 
values in TEF.VAL!!

Also, if you try to do this in a program:

TEF.TOTAL.VAL=0

It won't compile!!  It knows!!

Very cool (I think).

Ed

______________________________________________________________________
This e-mail has been scanned by MCI Managed Email Content Service, using 
Skeptic(tm) technology powered by MessageLabs. For more information on MCI's 
Managed Email  Content Service, visit http://www.mci.com.
______________________________________________________________________
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to