Created
February 16, 2017 08:37
-
-
Save fozoglu/b1758a7dddb280569d1712212cdb671b to your computer and use it in GitHub Desktop.
Guard kullanımı ile ilgili ufak bir örnek
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func writeLabel(firstTextfield: String) -> Int { | |
guard let d : Int = Int(firstTextfield) else { | |
let d : Int = 0 | |
print("Değer Yok") | |
return d | |
} | |
print(d) | |
return d | |
} | |
writeLabel(firstTextfield: "5") // Print : 5 | |
writeLabel(firstTextfield: "0") // Print : Değer Yok | |
writeLabel(firstTextfield: "asdf") // Print : Değer Yok |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment