Understanding logic flow
Logic flow is simply a step-by-step set of instructions. Let's understand it a bit more by looking at a set of instructions for feeding a puppy. 🐶
Puppy feeding instructions:
Locate the bag of puppy food.
Pick up the food bowl from the floor.
Set the food bowl on the counter.
Pick up the bag of dog food.
Open the bag of dog food.
Tilt the bag slowly towards the bowl.
Pour the food into the bowl.
Fill the bowl.
Close the bag.
Put the bag back in its original location.
Put the bowl on the floor.
Watch the puppy eat happily.
Each step is done sequentially, which means one after the other. You can’t do steps 2 and 3 at the same time, for example. Now, take a second look above and see if you can find any steps that are independent. As you know from the video, this means they don’t have to happen at a precise time.
Ready for an answer? Steps 2 & 3 can happen before or after steps 1, 4, or 5. As long they’re done before step 6, it doesn’t matter where they are in the order of steps. There are a few more independent steps in this sequence. Do you think you can locate them?
Try it out for yourself!
Did you write a list of steps for making your perfect cup of coffee or tea? Now, go through it and identify which steps are independent. Can you change the order of your hot beverage-making program?
A logic flow is the order in which steps are completed in a program.
Steps are completed sequentially, not simultaneously.
Some steps are independent, which means they can be completed in any order.