PROCEDURES WHICH ACCEPT ARGUMENTS
Procedures may also accept variables (data) to work with when they
are called.
Declaring the variables within the procedure
Calling the procedure and Passing variables (or values) to it
Consider the following program example,
program ADD_NUMBERS (input, output); procedure CALC_ANSWER ( first, second : integer ); var result : integer; begin result := first + second; writeln('Answer is ', result ) end; var number1, number2 : integer; begin writeln('Please enter two numbers to add together'); readln( number1, number2 ); CALC_ANSWER( number1, number2) end.
program TestValue (output); var x, y : integer; procedure NoEffect ( x, y : integer ); begin x := y; y := 0; writeln( x, y ) end; begin x := 1; y := 2; writeln( x, y ); NoEffect( x, y ); writeln( x, y ) end.Click here for answer