If condition p is true , then the statement or statement in the true case will be executed , and the statement in the false case will be skipped . Otherwise(the ELSE statement) the statement in the true case will be skipped and statement in the false case will be executed . In either case , control then passed to the next processing step after the delimiter ENDIF . A typical pseudocode example might read :
IF student_attendance_status is part_time THEN
Add 1 to part_time _count
ELSE
Add 1 to full_time_count
ENDIF
The selection control structure is discussed fully in Chapter 4 .
3. Repetition
The repetition control structure can be defined as the presentation of a set of instuctions to be performed repeatedly , as long as a condition is executed again and again, until a terminating condition occurs . This construct represents the sixth basic computer operation , namely to repeat a group of actions . It is written in pseudocode as :
DOWHILE condition p is true
Statement block
ENDDO
The DOWHILE loop is a leading decision loop – that is ,the condition is tested before any statement are executed . If the condition in the DOWHILE statement following that statement is found to be true , the block of statements following that statement is executed once . The delimiter ENDDO then triggers a return of control to the retesting , and so the repetition process continues until the condition is found to be false . Control then passes to the statement within the statement block alters the condition and eventually renders it false , because otherwise the logic may result in an endless loop .
Here is a pseudocode example that represents the repetition control structure :
Set student_total to zero
DOWHILE student_total