why we can omitt curly braces when we have only one statment after "if" and "else" statement?? | Sololearn: Learn to code for FREE!
Nowy kurs! Każdy programista powinien nauczyć się Generative AI!
Wypróbuj darmową lekcję
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 odpowiedzi
+ 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
Saad Saleem
Saad Saleem - 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