If/Else Blocks and Curly Brackets

Are curly brackets required on every if/else block? I have seen if/else code without them. Why?


  • 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

  • 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.

Howdy, Stranger!

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