Joleen Hall▸ Understanding Functions (Task 1)
An everyday activity that could be replaced by a function
MorningRoutine(typeOfDay ){
#input possible type of day SchoolDay, Weekend
#Assumptions: you have already woken up
if typeOfDay==SchoolDay{
#Each of these tasks could themselves be functions!
Get dressed
Make breakfast
Eat breakfast
Make lunch
Put lunch in bag
Pack bag
check you have everything for the day
}
else if typeOfDay==Weekend{
Get dressed
Make breakfast
Eat breakfast
Check plans for the day
if noPlans{
Watch TV
}
}
else{
#you must be on holidays…..enjoy!!
}
}
G+ Comments
no plus ones, 0 comments
You must log in to post a comment.
+ There are no comments
Add yours