Rexx Programming/How to Rexx/control structure

From Wikibooks, open books for an open world
Jump to: navigation, search

Control structures (also known as control constructs) are constructs used within a program to control the flow of a program based on given conditions. Control structure typically uses conditional branching instructions or loop control statements. Code within control structures is typically arranged into blocks in a similar fashion to control structures written in C.

Conditional Branching[edit]

The following example shows a conditional code being used as a conditional branch:

if guess = 6 then

 say "Wow! That was a lucky guess."


The following example shows a block of code being used in a loop:

do l = 1 to 10

 say l