Programming constructs - EduqasNesting

Programs are created using common building blocks, known as programming constructs. These programming constructs form the basis for all programs and are also used in algorithms.

Part ofComputer ScienceSystems analysis

Nesting

and constructs can be within each other. Any combination of selection and iteration is possible. So, for example, a for next might have an if … else … end if selection within it.

This example has an if … else … end if construct nested within another if … else … end if construct:

age is integer input “How old are you?”, age if age >= 16 output “You are old enough to drive a moped!” if age >= 17 output “You are old enough to drive a car!” end if else output “Come back when you are older!” end if