BIT116: Scripting Lecture 01

Functions
Quiz
Function calls – collect, call, receive
Function calls – accumulator practice
2
Next class: Work Day
 No new material
(there will be a quiz + participation points)
 Bring your homework to work on + ask questions about
 I’m very sorry for not announcing this earlier! 
Next Monday:
 A1 final revision, A2 (final) revision due
Next Wednesday:
 A3 (final) revision due
3
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
4
 Work on Exercises #1 and #2 for this part of this lecture
5
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.
6
 Work on Exercise #3 for this part of this lecture
7