Topic 3: Understanding Structure Flashcards
A logically snarled program statements
Spaghetti code
Known to be unstructured programs
Spaghetti code
A basic unit of programming logic
Structure
Three basic types of structures:
- Sequence
- Selection
- Loop
Directs the computer to process program instructions one after another in the order listed in the program
Sequence structure
Can contain any number of tasks, but there is no option to branch off and skip and of the tasks
Sequence structure
You ask a question and take one of two courses of actions
Selection structure
Also known as decision structure or an if-then-else or dual-alternative ifs/selection
Selection structure
In a ______ structure, you continue to repeat actions while a condition remains true
loop
Also called repetition or iteration
Loop structure
Programmers call this a while…do (or while loop)
Loop structure
Attaching structures end-to-end
Stacking
End structure in statements (in pseudocode)
- Endif: ends an if-then-else structure
- Endwhile: ends a loop structure
Placing one structure within another
Nesting
A group of statements that execute as a single unit
Block