function IncreasingSine(X: Real): Real; begin IncreasingSine := sin(X) * X end { IncreasingSine }; function InverseCube(X: Real): Real; begin InverseCube := 1 / (Sqr(X) * X) end InverseCube }; begin SumSeries } for Term := 1 to MaxTerms do Writeln(Term ,Sigma(IncreasingSine,I,Term), Sigma(InverseCube,I,Term)) end { SumSeries } 

## Produces as results: 

## I1.B.2 Side Effects 

1 8. 414710E~01 1.000000E+00 2 2.660066E+00 1.125000E+00 3 3.083426E+00 1.162037E+00 4 5.621672E~02 1.177662E+00 5~4.738405E+00 1.185662E+00 6~6.414900E+00 1.190292E+00 7~1.815995E+00 1.193207E+00 8 6.098872E+00 1.195160E+00 9 9.807942E+00 1.196532E+00 10 4.367733E+00 1.197532E+00 

An assignment (occurring in a function declaration) to a non-local variable or to a variable parameter is called a side effect. Such occurrences often disguise the intent of the program and greatly complicate the task of verification. Hence, the use of functions producing side effects is strongly discouraged. As an example, consider Program 11.10. 

program SideEffect(Output); { Program 11.10 ~ Illustrate function side effects. } var A, Z: Integer; 

