An if statement is the most basic of branching statements. It simply allows a block of code to be run if and only if a given condition is true.

Related Phrases Edit

  • If
  • When
  • then (partner suffix)
  • Or else
  • Otherwise
  • That's what I would do

FDS Edit

Declaration Edit

Else Edit

Ending Edit

Examples Edit

A simple single conditional:

Did you know that Pinkie Pie likes the number 15?

When Pinkie Pie was more than 1, I said "Too many Pinkie Pies!"!

That's what I would do.

Java Equivalent:

int Pinkie_Pie = 15;
if (Pinkie_Pie > 1){ System.out.println("Too many Pinkie Pies!");

See Also Edit