jeudi 22 octobre 2020

Swift Code Beginner... If-Statement Expected Declaration [duplicate]

I'm trying to build a simple app to sharpen my beginner's skills in Swift but I don't understand what type of Expected Declaration is needed?

Here is the code:

//Code starts here
        
var weight = Double()
var height = Double()
var bmi = Double()
            
func findBMI() -> Double {
    return weight / (height * height)
}
    
var userBMI = Double()
if userBMI <= 15 {
    print("")
}

The Expected Declaration is @ if userBMI <= 15 {

I have been changing my code over and over again but I haven't found the solution yet. Can anybody help and tell me what is wrong with my code?

Aucun commentaire:

Enregistrer un commentaire