What is difference between IF THEN and IF THEN ELSE statement?
An if-then statement, or simply an if statement, checks if a
stated condition is true. If the condition is true, then a block of
code will then execute.
Example:
if number equals 3
print out "Number equals 3"
An if-then-else statement, or simply an if-else statement,
checks if a stated condition is true. If the condition is true,
then a certain block of code will then execute. If the condition is
false, then a different block of code will then execute.
Example:
if number equals 3
print out "Number equals 3"
else
print out "Number does not equal 3"
For both if statements and if-else statements, there is only one
stated condition. The difference between them is that an if
statement will only cause something to happen if the condition is
true. An if-else statement will execute a block of code whether the
condition is true or false.