Passing Arguments Question Example: IS1102 Exam Autumn 2001
Break it down 2 Variables declared at module level [General Declarations] cmdCalculate_Click (Event Procedure) Display (Sub Procedure) AddNum (Sub Procedure) IncrementNum (Function Procedure – returns a value)
Begin with event procedure (user click) Assigns values to variables Makes Calls to Procedures and Functions
AddNum Procedure: Watch out for argument (in brackets) Makes call to the function procedure (IncrementNum) Makes call to sub procedure (Display)
Function Procedure (IncrementNum) Changes variable values (watch out for local Vs module variables) Value is returned (IncrementNum)
Prints to Picturebox Watch out for NewNum (receiving passed value) If Statement checks value of Num4 and statements executed depending on result