If/Else Blocks and Curly Brackets - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

If/Else Blocks and Curly Brackets

pleb1606pleb1606 Posts: 4Member
Are curly brackets required on every if/else block? I have seen if/else code without them. Why?

Comments

  • sunlotussunlotus Posts: 55Member

    Some use it by convention, easier to read. Just how they make classes names in java start with capital letters, though it's not a must

  • thakur66thakur66 BangalorePosts: 5Member

    Curly Brackets are not mandatory in every if/else block, how ever in order to make your code more readable (i.e; easily distinguish the nested if else block of code ) you should use the curly brackets.

Sign In or Register to comment.