ELSE before IF is not allowed

ELSE cannot occur before IF, since it depends on it. Here is an example of a correct IF statement:

if x > 3
  a = 1
elseif x > 2
  a = 2
else
  a = 3
endif

See Also
Errors