Answer:
As in the real world, people using a program would provide different inputs, that would require different outputs. For example in a traffic light system, there could be a function that constantly checks for if the button is pressed. When the button is pressed the traffic light loop would branch out of its current running code in order to turn the lights to red, and allow the pedestrians to cross.