Computer Science, asked by shreenidhi2076, 8 months ago

Different between IF_THEN and IF_THEN_ELSE statement

Answers

Answered by amanjukaku
1

When you use the if_then, you check the condition. If the condition is true, it executes the program otherwise it will just skip that statement and continue the program written after it.

If you use the if_then_else statement, and the condition is true it will execute the program written after the if_then statement and skip the program written under else statement. If the condition is false, it skips the program written below the if_then statement and runs the program under the else statement.

For example:

You can use the if_then_else statement for this program: to check whether a number is even or odd. The program must be like :

If the remainder of a number divided by 2 is 0, the number is even

Else it's odd

Similar questions