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

3/27/2020 7:11:20 AM


4 Answers

New Answer


This is specified in the language Grammer rules that a curly brace is optional if you have only one statement in conditional block. It is also optional if you have one statement in loops.


No need for curly brackets for one line. But you can also used brackets in code for yourself for understanding Optional


it is just good practice to use them


Means it is just grammer..but behind this grammer rule there might be some reson