mercredi 10 juin 2015

Swift If program

Still a beginner with just playing around with some basic functions in swift.

Can someone tell me what is wrong with this code?

import UIKit

var guessInt:Int
var randomNum = arc4random_uniform(10)


if Int(randomNum) == guessInt {


println ("correct")

}  else {


println; "no, the number is not. guess again"

}

So far the only error I'm getting is that

guessInt

is being used before being initialized! I've tried to type everything again but still have the same error.

Thanks in advance.




Aucun commentaire:

Enregistrer un commentaire