Page 70 - ModularV1.1 _c7_flipbook
P. 70
08 CONDITIONAL AND
LOOPING STATEMENTS
IN BASIC-256
Your Aim
to learn about:
Conditional Statements Looping
For...Next Statement Sample Programs using For...Next Statement
While…END...WHILE Statement Sample Programs using While…END...WHILE Statement
Infinite Loop
We make decisions in our daily life based on the conditions that we are in or the conditions that
we know we will face in a particular situation. For example, in the above situation, your decision
will be based on a condition; for example, if the lift is working, use it or else climb the stairs.
We face similar situations when we are programming. We have to make some decisions and
based on these decisions, the statements in the program are executed. In some conditions, our
program statements are based on the outcome. If the outcome is true, one set of commands is
executed and if the outcome is false, the other set of commands is executed.
CONDITIONAL STATEMENTS
Decision making in BASIC-256 is done by conditional statements or decision-making statements
that decide the direction of flow of program execution. Since they control the execution of the
program, we also call them Control statements. Control statements available in BASIC-256 are
given below:
IF-THEN Statement IF-THEN-ELSE Statement
IF-THEN Statement
The IF-THEN statement is the simplest conditional
statement. Here, certain statement or block of Execute
Is
statements within the if block is executed only if the Yes statement(s)
condition
specified condition evaluates to true. If the condition
evaluates to false, then the control of execution is true
passed to the last statement, outside the if block. No
The syntax of the IF-THEN statement is given below.
IF <condition> THEN Statement after
Statements to be executed END IF
END IF
68 Modular (Ver. 1.1)-VII

