2014-12-19 22 views
13

Mi sono guardato intorno ma sono stato sorpreso di non riuscire a trovare nulla che spiegasse questo. Se ho:Come restituire il valore booleano da una funzione in Swift

func checkEmail() 

{ 
    var test = true 

    return test 
} 

...elsewhere in the code.... 

var emailStatus = checkEmail() 

Come posso fare in modo che questa funzione restituisca il valore booleano di vero?

risposta

31
func checkEmail() -> Bool { 
    var test = true 
    return test 
} 

Altrove nel codice ....

var emailStatus = checkEmail() 
Problemi correlati