Page 81 - 2502_Pakistan-kifayat_C-8
P. 81
Print "You can play outside"
End
The above pseudocode checks if either the homework is done or it is the weekend. If at least one of
these conditions is true, it displays "You can play outside.
USING SEQUENCE, LOOPS, AND CONDITIONS
Computers follow instructions step by step. In programming, we use three main building blocks to
solve problems:
Sequence Loops Conditions
Sequence
A sequence is a set of instructions that are carried out in order, one after another. It is the simplest
form of logic in programming. Every program starts with a sequence of steps to follow. Sequence is
used when you need to follow steps in a fixed order.
For example, brushing your teeth includes the following steps:
Pick up toothbrush Apply toothpaste Brush teeth.
Start
Print "Pick up toothbrush"
Print "Apply toothpaste"
Print "Brush teeth"
End
Loop
A loop is used to repeat actions without writing the same code again and again. Loops are helpful when
we need to do the same task multiple times. There are different types of loops like Repeat and Forever.
A loop is used when you need to repeat something.
For example, clapping your hands 5 times.
Start
REPEAT (5)
Print "Clap"
End
Condition
A condition allows the program to make decisions based on whether something is true or false. It
helps in choosing between two or more possible actions. Conditions often use If, Else, AND, OR in
pseudocode. Condition is used when you need to make a decision based on a situation.
#Nesting 79

