lundi 27 avril 2015

Can't use if statement because "Need decluration"

my declared variables in Xcode 6.0 viewcontroller class

var userScoreTotal = 0
var computerScoreTotal = 0

if userScoreTotal == 10 {
}

I keep getting an error message saying that "userScoreTotal" needs to be declared even though they were already 2 lines above. Both variables are connected to an ifTapped action to increment score.

I tried

if self.userScoreTotal == 10 {
}

but the same message appears

Aucun commentaire:

Enregistrer un commentaire