loading...

Functions in Daily Life

keeposteepo profile image keepoSteepo ・2 min read

To be honest, if you really wanted to, ANY process or task of real life can be broken down and defined into a function. Off the top of my head I can think of breakfast, showering, driving, cutting the grass and working out.
Breakfast can be broken down into ingredients, how many people you’ll be cooking for, how much time you have (if that is of importance) & perhaps even the number of ingredients you have if you don’t know what you are cooking yet. You could even have a function with if statements so that in case one of the conditions is not met, like the number of people changed, then something else can get executed.
Showering can be placed into a function in different ways, but one of them could be inside of an if statement. The if statement would be if cold water then certain time in the shower, else if (hot water) the more time in the shower. Inside the function time in the shower and time for each would be defined.
Driving can be in defined in a function by distance being traveled, destination, speed of travel & perhaps even miles or gas spend per mile depending on what is trying to be achieved.
Cutting the grass is more challenging than the mere phrase “cutting the grass“ implies, to cut the grass, you have to get various materials ready, make sure the machine has gas & oil, get the trash cans closer & it can be broken down further to the actual process as far as how big the yard is and how any times you might have to go over it to complete the job. All of this can be calculated by a function.
Finally, working out isn’t a task that is black and white. Depending on the individual, working out might consist of first stretching properly with various poses, then a warm up for whatever body part being targeted which usually consist of various exercises & finally, the workout itself, which is conglomerate of more exercises. All of this can be put into a function to decide or calculate what exercises will be executed for the current day.

Posted on by:

Discussion

pic
Editor guide