SLIDE 04          < Previous     Next >          Close Window

for (i=0; i<10; i++) processData(i);
i=0; checkSum=0;
while (checkSum< 1000
&&     checkSum!= 450
&&     checkSum!= 735) {
  for   (x=0; x<10; x++) {
    for (y=0; y<20; y++) {
      addUp(&checkSum,x,y); if (y<5) checkSum++; }}   //  SPEC51-compliant.
  i++; }

One or more close-braces are always followed by a corresponding decrease in indentation on the next line.  Diagnosing brace errors is easy — just look for any local deviation from the brace-indentation rule.