0

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

3/27/2020 7:11:20 AM

Abhishek

4 Answers

New Answer

+4

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.

+2

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

0

it is just good practice to use them

0

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