What Are Conditional
Statements?
Suppose you want to protect your
program with password.
You ask from the user to enter the password.
If the
password is correct - you want to let the user in, if not - you want to end the
program.
To do this, you have to use conditional statement because
the
code you will execute (let the user in or end the program) is
depend on what
is the password that the user has entered.
One of the basics of
Conditional statement are Boolean variables.
Boolean variables are commonly used in programming,
and you have to understand them
before continuing with conditional statements.
Boolean Variables
As we learnt, String variables store
text, and
Integer Variables Store numbers.
Boolean variable
stores one of the following constant values:
"True", or "False".
For example:
Dim Kuku As Boolean
Kuku =
True
Dim YoYo As Boolean
YoYo = False
What are the True and False stand
for?
They are the result of every "Boolean
expression".
Boolean
Expressions
Boolean expression
is like a question that
the answer to it is "True" or "False"
For
example:
Is 4 Plus 6 is 10? True
Is 2 bigger than 4? False
But
the question
How much is 4 Plus 6?
Is not a boolean expression, because
its answer
is 10 (and not True or False)
Examples of Boolean expressions in the next page.