// guard func sayHello(_ msg: String?) { guard let s = msg else { print("value not set!") return } print(s) } sayHello(nil) //----- "value not set!" sayHello("TEST") //----- "TEST"