DEV Community

Antonio
Antonio

Posted on

functions in real life

What processes and tasks, from real life, can fit into the various ways you can define a function? (Explain at least 5)

The function contains instructions used to create the output from its input. In that case, let's give 5 examples of real life situations that would mimic functions in coding.

1- Working out. A person needs to eat right, take whatever pre workout, that's the input, the out put would be, being more fit and building muscle

2- gaining weight. A person eats junk food, overloads on carbs and doesn't exercise, that's the intake. the outtake would be weight gain and poor health

3- driving a car. Person put gas into their car, that's the input. the output would be that the car drives without any issues. with this, the input needs the right kind of fuel. If you put water in the car, because it's the wrong input, then the output would be a not operational vehicle.

4- going to school. A person attended school to gain knowledge. So the intake is lecture, work and homework. The output is taking that knowledge and applying it to you job or life and understand what you are doing.

5- losing weight. A person limits the amount of carbs and sugars from their diet, so the outtake is less then the intake, so the person will loss weight.

Top comments (0)