Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func doSomething(object: AnyObject) {
- guard let object = object as? String where object.hasPrefix("hel") else {
- return
- }
- print(object.uppercaseString)
- }
- doSomething("hello")
- func doSomethingWithBool(bool: Boolean, name: String?) {
- guard bool, let name = name else {
- return
- }
- print("bool is true and name \(name)")
- }
- doSomethingWithBool(true, name: "damien")
- func multiUnwrap(URL: NSURL?) {
- guard let URL = URL, host = URL.host, path = URL.path else {
- return
- }
- print(URL, host, path)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement