Discovering Functions
Learn about the basic concepts of Functions
We'll cover the following...
The role of functions
To understand the importance of functions, let’s refer back to the burrito algorithm.
Press + to interact
BeginGet out the rice cookerFill it with riceFill it with waterCook the riceChop the vegetablesStir-fry the vegetablesTaste-test the vegetablesIf the veggies are goodRemove them from the stoveIf the veggies aren't goodAdd more pepper and spicesIf the veggies aren't cooked enoughKeep stir-frying the veggiesHeat the tortillaAdd rice to the tortillaAdd vegetables to the tortillaRoll tortillaEnd
Here’s the same general idea, written in a different way.
Press + to interact
BeginCook riceStir-fry vegetablesAdd fillingsRoll togetherEnd
The first version details all the individual actions that make up the cooking process. The second breaks down the recipe into broader steps and introduces concepts that could be re-used for other dishes as well like cook, stir-fry, add and roll.
Our programs so far ...
Access this course and 1400+ top-rated courses and projects.