by Dinesh Thakur Category: Variables and Constants

1. A power full asset of the computer is its ability to make decisions and to take alternate course of action based on the out come.

 

2. A decision made by the computer is formed as a question: is a given condition is true of false.

 

3. Decision can be taken using If statement which is used as follows:

 

If the sun is shining Then                    (Condition)

Go to beach                                        (Action to take)

Else

Go to Class                                         (Action if Condition is false)

End If

 

4. In If statement, when the condition is true, only Then clause is executed. When condition is false, only the Else clause, if present is executed.

 

If… Then statement general form is

 

If (Condition) Then

Statement(s)

Else

Statement(s)

End If

 

5. A block If … Then … Else must always include with End If. The word Then must appear on the same line as the If with nothing following Then. End If and Else clauses are indented for readability and clarity.





About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.