if/else statements come in a couple of flavors that seemed confusing to me at first glance so here is how I make sense out of them for myself.

Basic Form

The form you will find pretty much in every book and online.

if(test) {
   //executes if test returns true
} else {
   //executes if test returns false
}

Twist of Syntax

This is the quick one-liner version. Reminds me of the ruby trailing if a bit.

if(1 == 1) println("hello")

All on one line, not my favorite but does work

if(1 == 2) println("hello") else println("bye"")

Multiple tests

Less punctuation and more concise.

if(1 == 2) println("no")
else if (2 == 3 ) println("no")
else println("yes")

or you can also do

My preference would be to do it like this.

if(1 == 2)
  println("no")
else if (2 == 3 )
  println("no")
else
  println("yes")

Blocks of code that need to be executed

We need the {} around the blocks as soon as we are executing more than a one line statement

if(1 == 2) {
  println("inside a false test")
  println("no")
}
else if (2 == 3 ) {
  println("inside a false test")
  println("no")
} else {
  println("inside a true test")
  println("yes")
}