Prg/211 Wk 3 Supporting Activities Software Program Control Flow

842 Words4 Pages
PRG 211 WEEK 3 Supporting Activities Software Program Control Flow * What is sequential flow of a program? * What is branching within a program? * How is branching controlled? * What is the role of an IF statement in control structures? Sequential flow of a program refers to the order in which the individual statements, instructions, or function calls of an imperative or a declarative program are executed or evaluated. In sequential flow, the process is presented in a chronological order meaning that the flowchart will go from step one, to step two, to step three and so on. It will not skip around. A branch within the program means that a diversion has occurred from the linear program flow. These branches can be divided into two categories which are unconditional and conditional. Unconditional branching allows the programmer to move specific parts of the code when the situation calls for it. Conditional branching allows the programmer to devise logical diversions in a program flow based on certain criteria (i.e. IF, SWITCH, LOOP). Branching is controlled by structures that allow the flow of execution to jump to a different part of the program. There are three common branching control structures which are BREAK, CONTINUE and GOTO. BREAK is the control structure that terminates the existing structure. CONTINUE is the structure that causes a loop to stop its current iteration and begin the next one. GOTO is the structure that causes the logic to jump to a different place in the program. The IF statement allows the programmer to control a program entering a section of code or not based on whether a given condition is true or false. An important function of the IF statement is that it allows the program to select an action based upon the users input. Single-Dual Alternatives and Case Structures * What are the similarities and differences

More about Prg/211 Wk 3 Supporting Activities Software Program Control Flow

Open Document