why we can omitt curly braces when we have only one statment after "if" and "else" statement?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

why we can omitt curly braces when we have only one statment after "if" and "else" statement??

27th Mar 2020, 7:11 AM
Abhishek
3 Answers
+ 2
No need for curly brackets for one line. But you can also used brackets in code for yourself for understanding Optional
27th Mar 2020, 7:16 AM
Mr Robot
Mr Robot - avatar
0
it is just good practice to use them
27th Mar 2020, 8:37 AM
Jim Munene
Jim Munene - avatar
0
Means it is just grammer..but behind this grammer rule there might be some reson
27th Mar 2020, 9:13 AM
Abhishek