如何从Swift中的函数返回布尔值

Sch*_*999 22 xcode boolean function swift

我环顾四周,但很惊讶我找不到任何解释这个的东西.如果我有:

func checkEmail ()

{
   var test = true

   return test
}

...elsewhere in the code....

var emailStatus = checkEmail ()
Run Code Online (Sandbox Code Playgroud)

如何使此函数返回布尔值true?

Li *_*Jie 45

func checkEmail() -> Bool {
   var test = true
   return test
}
Run Code Online (Sandbox Code Playgroud)

代码中的其他地方....

var emailStatus = checkEmail()
Run Code Online (Sandbox Code Playgroud)