Is else is required in else if statement. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Is else is required in else if statement.

19th Nov 2019, 2:25 PM
Nitya
Nitya - avatar
3 Answers
+ 4
No it is not compulsory to use 'else' after 'if'. But it is compulsory to use 'if' before 'else'. In one sentence 'if' is compulsory but 'else' is optional
19th Nov 2019, 2:40 PM
ツSampriya😘ツ
ツSampriya😘ツ - avatar
+ 1
You need not have an "else" after "if", it is just used to do something if at all your "if" fails.
19th Nov 2019, 2:30 PM
Avinesh
Avinesh - avatar
0
No it's not essentially to have "else" block, bz it's executes only if the given condition is false in "if" block.
20th Nov 2019, 10:27 AM
Naved