Howdy, Stranger!

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


If/Else Blocks and Curly Brackets

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


  • sunlotussunlotus Member Posts: 55

    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 BangaloreMember Posts: 5

    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.