next up previous contents index
Next: if/else and ternary operators Up: Conditionals Previous: Conditionals   Contents   Index


if() { }

The simplest form of a conditional is a single if() statement:
age = 22;
if (age < 30) {
  printf("You probably don't remember the Beatles, do you?");
}
If there is only one statement to be carried out, the matching curly braces may be omitted:
age = 22;
if (age < 30)
  printf("You probably don't remember the Beatles, do you?");