Control Flow of a Program
Control flow of a program refers to the order of execution of various code elements in the program. This means that we can ask the program to perform certain actions when some specific condition is triggered. This allows the program to make decisions according to different situations that it may encounter during its execution.
The first control flow element that we will discuss is if/else
statements. They allow the programmer to specify certain decisions within a program and execute different statements in a program under various specified conditions. The second control flow element discussed will be try/catch
statements. They are responsible for handling errors and exceptions that may arise in a program. They change the flow of execution whenever such a situation occurs so that the flow of execution of the program is not disturbed.