Computer Science, asked by anita7808, 5 months ago

What is the difference between if statement and if...else statement

Answers

Answered by manaskhandelwal00
22

If the statement just tells If this condition is true then do this specific work and it is false do nothing.

But in the case of If...Else statement the if conditions work the same but if the condition is false the task assigned to the else statement will work..

Eg. Here I have taken Python programming language..

a = 200

a = 200b = 33

if b > a:

if b > a: print("b is greater than a")

else:

else: print("a is greater than b")

Hope this helps..

Answered by Gauri77552
4

Answer:

Here it is...

Explanation:

The if statement give only one answer true or false whereas the if...else statement provide a two-way brancing in a program. The First set of commands is indented under the 'if' statement and the second set under the 'else' statement.

Similar questions