CONDITION STATEMENT

Suppose you want to protect your program with password. You asked the user the user to enter the password. If the password is correct, the user enter into the program or if the password is incorrect, you may not provide excess to the user conditional statement are those statement in which we specify some special condition.

1. If—-Then.

2. If—-Then—-Else.

3. Select Case.

IF—-THEN

The If—-Then statement test we condition to specific and If true, statement (S) that follow.

If or condition is false, if condition If the statement following the If structure.

SYNTAX:

If condition

Then

Statement

EXAMPLE:

If Month = “July”

Then

Year = “2011”

IF—-THEN—-ELSE

If—-Then—-Else executes a no of statement If the condition is true and other is condition is false.

EXAMPLE:

If Marks <70

Then Result = “Pass”

Else

If Marks >90

Then

Result = “A+”

SELECT CASE

The Select Case appears one expression to different value. The advantages of Select Case over If—-Then—-Else is that if makes the code easier to read and maintain.

SYNTAX:

Select

<expression>

Case1

Statement1

Case2

“!”

!

!

End case

End select

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s