If you want to call a procedure/function with variables and you want that procedure/function to modify parameters value, add var keyword in procedure/function parameter declaration:
procedure SwapNum(var A, B: Integer); var Temp: Integer; begin Temp:= A; A:= B; B:= Temp; end; var x, y: Integer; begin x:= 10; y:= 20; SwapNum(x, y); Writeln('X = ', x); Writeln('Y = ', y); end.
This type of passing parameters is called calling by reference it requires a variable with the same exact type to by passed and it will not work if a constant or values with other types are passed.