jeudi 22 décembre 2016

Swift || OR Function Issue

I'm trying to create an if-then function.

Code:

if year == 2016 && month == 12 && (day == 21 || day == 22) && canLight == true{

print("works")

}

However, ever since I added the || part, it is not working. Before it worked successfully when I just used one date/day such as the 22nd, but now that I try to get the function to work when it is either the 21st or 22nd, it no longer works.

Any ideas?

And yes, the day I am testing this code IS on the 21st or 22nd.

Problem Summarization: || won't work

Thanks!!

P.S: ALL my code is being done in Swift 2, NOT 3

Aucun commentaire:

Enregistrer un commentaire