vendredi 1 février 2019

How do i write the if - else if code properly

I'm trying to make an if - else if statement writing two comparison operators in the 'else if' line (Int type). maybe is the syntax wrong?

i've tried to remove the parentheses from 'boysAge >= 21' but same results

var boysAge = 21
var message = "The customer is "
if boysAge < 21 {
    message += "underage"
}
else if (boysAge >= 21) && <70 {
    message += "allowed"
}
print(message)

xcode says that '<' is not a prefix unary operator

Aucun commentaire:

Enregistrer un commentaire