The other answerers may have confused you by saying else if not if else.
For an if statement.
It checks if a condition is true, and if it is true, then the statements involved in this if statement are executed.
For example,
if (something is true) {
print out that it is true;
}
An if else statement is a bit different, it includes a second clause, the else part. Similar to the if statement, It checks if a condition is true, and if it is true, then the statements involved in this if statement are executed. If the condition is false however, the else clause is executed.
For example
if (something is true) {
print out that it is true;
} else {
print out that it is false;
}
2006-11-06 03:45:57
·
answer #1
·
answered by Mark aka jack573 7
·
0⤊
0⤋
If statement is a conditional response. Like IF you go to school, THEN you will pass your exam. ELSE IF is used to add a second layer of conditioning into your orginal statement.
For example, IF you go to school, THEN you will pass your exam, ELSE IF you go to the party, THEN you will not know when the exam is.
ELSE is used when the IF is not satisfied. IF (1) THEN (2) ELSE (3). If (1) is true, then the outcome is (2). But if (1) is not true, the outcome is (3). With ELSEIF, instead of (3), you just add another IF statement there.
2006-11-05 01:26:29
·
answer #2
·
answered by Bruce__MA 5
·
1⤊
0⤋
You might indicate what environment you are using (e.g. Visual Basic)
Basically an If statement says do what ever is after the if when the condition stated in the if statement is true.
An if else statement says do what ever is after the if when the condition stated in the if statement is true otherwise do whatever is after the else
2006-11-05 01:24:13
·
answer #3
·
answered by Mn 6
·
1⤊
0⤋
An 'if' statement is only entered when the condition you placed is true. Otherwise the software will move to next line of coding.
With 'if else' statements, you select what should be done both times: when the condition of 'if' is true and when the condition is false 'else'.
Hope it helps.
2006-11-05 01:25:27
·
answer #4
·
answered by devs Advoc8 3
·
1⤊
0⤋
If Season = Winter Then
ToDo= PutACoat
ElseIf Season = Summer Then
ToDo=PutABathingSuit
ElseIf Not Season=Autumn Then
ToDo= WearSpringClothes
Else
ToDo=WearAutumnClothes
End If
2006-11-05 01:32:03
·
answer #5
·
answered by redchemistry1 2
·
1⤊
0⤋
If you mean VB 6 then i can help, although I don't know much about VB.Net, you don't do if else, you do else if and as one word.. like so..
If Hello = 2 then
Label1.Caption = "The number is 2"
ElseIf Hello = 3 then
Label1.caption = "The number is 3"
Else
Label1.caption = "The number isn't 2 or 3"
End If
Choose me as best for more info..
2006-11-05 01:41:29
·
answer #6
·
answered by Aaron 5
·
0⤊
0⤋
try to read Dennis Ritchie which will give clear explanation. Try to see in C-faq ( search for that in google)
2006-11-05 01:24:36
·
answer #7
·
answered by freak_iitb 2
·
0⤊
0⤋
Hell, I'm having problems understanding your question !
2006-11-05 01:20:16
·
answer #8
·
answered by Mr. Right 4
·
1⤊
0⤋