Functions

advertisement
Functions
Assignment #2 Revision is now due on
Tuesday, May 24th
Quiz
Exam Redo Question
 This is worth 20 points
2
Basic Functions: Collect, Call, Receive
 Collect, call, receive:
1. The event handler will collect the data from the form
2. The event handler will then call the function (passing in that data)
3. The event handler will get the return value
 Let’s look at Collect_Call_Receive.html
3
 Work on Exercises #1 and #2 for this part of this lecture
4
Defining a New Function (Collect, Call, Receive)
 Template: collect, call, receive
1.
Have event handler collect up data
2.
Pretend the function exists already and call it from the event
handler
3.
Set up the function definition
 Focus on what parameters to include
 Put a comment above the function describing what it does, and what it returns
4.
Fill in the function’s logic
5.
Return the result from the function back to the event handler
6.
Receive the result in the event handler and do something with
it.
5
 Work on Exercise #3 for this part of this lecture
6
Download