7/n - Procedures first (NO parameters yet)
Just procedures first. Let students practice defining, calling and the new flow of a modular program without the extra load of parameters and return values.
#TeamCompSci #CASchat #CSed #CSK8 #CSScot
Just procedures first. Let students practice defining, calling and the new flow of a modular program without the extra load of parameters and return values.
#TeamCompSci #CASchat #CSed #CSK8 #CSScot
Comments
Now introduce data going IN to the sub program. Still super simple examples here (adding two numbers etc).
#TeamCompSci #CASchat #CSed #CSK8 #CSScot
Next, return values. Hard coded calculations that return the value back to the main program. I teach to ALWAYS assign the return value to a variable (one thing per line) for use in the main program. No parameters yet.
#TeamCompSci #CASchat #CSed #CSK8 #CSScot
Data going in and out of the sub program. Now we can make our calculator useful. I teach to get user input in the main then send the arguments to the subs, which do the calc and return the answer into a variable in the main.
#TeamCompSci #CASchat #CSed #CSK8 #CSScot
Great thread Andy.
https://en.m.wikipedia.org/wiki/Separation_of_concerns
Now you can start to 'reveal' the magic hacks/shortcuts. Call one sub from within another. Use a returned value as an argument for a different sub. Calling from a print or as part of a calculation. Let them create from solid foundations
Fin
#TeamCompSci #CASchat #CSed #CSK8 #CSScot