ArtiSynth Coding Standard

3 Always used braced blocks

As in the Sun rules, code following control constructs is always enclosed in a braced block, even when this is not necessary. That means that

   for (int i=0; i<cnt; i++) {
      if (i % 2 == 0) {
         System.out.println ("Even");
      }
      else {
         System.out.println ("Odd");
      }
   }

should be used instead of

   for (int i=0; i<cnt; i++)
      if (i % 2 == 0)
         System.out.println ("Even");
      else
         System.out.println ("Odd");

The reason for this is to provide greater uniformity and to make it easier to add and remove statements from the blocks.