Home Segments Index Top Previous Next

167: Mainline

Another way to get the effect of the nonexistent unless statement is via an if-else statement with an empty statement—one that consists of a semicolon only—in the if-true position. Thus, the following tests are equivalent:

if (ratio < 10) printf ("It is cheap!\n"); 
if (ratio >= 10) 
   ; 
  else printf ("It is cheap!\n");