Slr 23 Flashcards
Sequence
Executing instructions one after another
Selection
A construct that allows a program to change direction depending on the outcome of a condition
Selection example
If statement
Iteration
Allows user to repeat sections of code
Iteration example
For loop (count controlled- number of iterations known before)
While loop (condition controlled- number of iterations not known because the variable used to determine when it ends is changing within the iteration itself)
Nest programming constructs
Iteration or selection (or both)
Local variable accessibility
Single subroutine only
Local variable created
Declared inside a subroutine
Local variable destroyed
When the subroutine exits
Global variable accessibility
Entire program
Global variable created
Declared outside a subroutine. Typically at the start of a program.
Global variable destroyed
When the program ends
Modularity
Concept of breaking down a large program or problem into smaller chunks
Modularity goal
To design a program in a way that each module carries out a single, specific task
Modules known as
Subroutines, procedures, functions, methods