It is good to put "if" without "else"? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

It is good to put "if" without "else"?

16th May 2020, 5:13 PM
Unknown Ambusher 🗡️
Unknown Ambusher 🗡️ - avatar
2 Answers
+ 11
Yes, there is no problem in that. "Else" is not required. You only use it when you want something to happen when condition in if is false.
16th May 2020, 5:16 PM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar
+ 3
Thank u bro
16th May 2020, 5:22 PM
Unknown Ambusher 🗡️
Unknown Ambusher 🗡️ - avatar