Professional Documents
Culture Documents
3Q 5th Monthly Test Reviewer Computer 10 WEEK 1-3
3Q 5th Monthly Test Reviewer Computer 10 WEEK 1-3
Objectives:
At the end of the day, I will be able to:
a. state the function of If-Then-Else and Nested If statements;
b. understand Select-Case statements; and
c. properly use conditional statements when making programs.
Key Concepts:
If - serves as the beginning of the statement.
Else - serves as the connection to the next statement if the condition is found to be false.
End If – serves as the ending of the If - Then - Else structure.
Discussion:
Conditional Statements
IF-THEN-ELSE Statement
The If - Then - Else statement tests the value of a certain condition. If the condition
is true, the statement between If and Else will be executed. If the condition is false,
the statement between Else and End If will be the one executed.
SELECT-CASE STATEMENT
The Select-Case statement is used when there are several conditions. It is easier to
understand, follow logically, and presentation than a series of Nested Ifs.
This conditional statement evaluates the text expression once and then compares it
with the expression lists. If a match is found, the statements in the corresponding
statement block are executed.
THE CONDITIONAL STATEMENTS
Conditionally executes a group of statements, depending on the value of an expression.
If condition [ then ]
[ statements ]
[ ElseIf elseifcondition [ Then ]
[ elseifstatements ]]
[ Else
[ elsestatements ]]
End If
-or-
If condition Then [statements] [ Else [ elsestatemnts ]]
Parts
condition
Required. Expression. Must evaluate to True or False, or to a data type that is implicitly
convertible to Boolean.
Then
Required in the single-line form, optional in the multiple-line form.
Statements
Optional. One or more statements following If…Then that are executed if condition
evaluates to True.
elseifcondition
Required if ElseIf is present. Expression. Must evaluate to True or False, or to data type
that is implicitly convertible to Boolean.
elsestatements
optional. One or more statements following ElseIf…Then that are executed
if elseifcondition evaluates to True.
elsestatements
Optional. One or more statements following if no previous condition or elseifcondition
expression evaluates to True.
End If
Terminates the If… Then…Else block.
Topic: LOOP STRUCTURES
Objectives:
At the end of the day, I will be able to:
d. understand how For-Next statements work;
e. state the function of Do-Loop statements;
f. use While-Wend statements to replace Do-Loop statements; and
g. identify the loop structures to be used when making programs
Fuel – Up:
Discussion:
LOOP STRUCTURES
Loop structures repeat a block of statements. These statements are executed for an
indefinite number of times while a condition is true, or until a condition becomes true.
DO LOOP STRUCTURE
Do loop structure are statements that are executed while the condition in a Do-Loop
statement is true.
DO-UNTIL STATEMENTS
-are statements that are executed while the condition in a Do-Loop statement is
False.
WHILE-WEND STATEMENTS
-similar in structure to the Do-Loop statement.
While-Wend statement can be replace the Do While Loop in a Do-Loop statement.
One disadvantage, however, is that the While-Wend statement does not have a way
to exit prematurely. The For-Next loop has the Exit command for that purpose, while
the Do-Loop has the Exit Do.