Last active
August 29, 2015 14:02
-
-
Save michaelavila/49b57c8e74e239308d8a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import Cocoa | |
var name: NSString? | |
func bang_and_greet(name:NSString!) { | |
println("hello \(name)") | |
} | |
func dont_bang_and_greet(name:NSString) { | |
println("hello \(name)") | |
} | |
// this works fine, prints "hello nil" | |
bang_and_greet(name) | |
// this throws an error, "name not unwrapped" | |
dont_bang_and_greet(name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment