Is else is required in else if statement. | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 3

Is else is required in else if statement.

19th Nov 2019, 2:25 PM
Nitya
Nitya - avatar
3 Respostas
+ 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