next up previous contents
Next: Recursive Procedures Up: Program Units Previous: Required Interfaces

 

Side Effect Functions

If, in

    rezzy = funky1(a,b,c) + funky2(a,b,c)

funky1 and funky2 modify the value of, a then the order of execution could be important. Consider:

    INTEGER FUNCTION funky1(a,b,c)
     ...
    a = a*a
    funky1 = a/b

and

    INTEGER FUNCTION funky2(a,b,c)
     ...
    a = a*2
    funky2 = a/c

With a=4, b=2 and c=4 the following happens:

A properly constructed function should not change its arguments or any global entities.

For more information, click here gif


next up previous contents
Next: Recursive Procedures Up: Program Units Previous: Required Interfaces

©University of Liverpool, 1997
Wed May 28 23:37:18 BST 1997
Not for commercial use.