[Swift-user] 'else if' on control structures

Allan Espinosa aespinosa at cs.uchicago.edu
Mon Jan 31 15:23:14 CST 2011


Section 2.7.3.2. of the userguide says that the if statement only
supports "if" and 'else' in the control structure.

Does this mean I cannot do 'else if's?

if (expr1) {
   statement1;
} else if (expr2) {
   statement2;
}
...
} else {
   statement_n;
}

I could put another set of if control statements in side the upper
else clause, but will result in a ridiculously indented code afterward
:)

-Allan

-- 
Allan M. Espinosa <http://amespinosa.wordpress.com>
PhD student, Computer Science
University of Chicago <http://people.cs.uchicago.edu/~aespinosa>



More information about the Swift-user mailing list