Skip to content

Instantly share code, notes, and snippets.

@michaelavila
Last active August 29, 2015 14:02
Show Gist options
  • Save michaelavila/49b57c8e74e239308d8a to your computer and use it in GitHub Desktop.
Save michaelavila/49b57c8e74e239308d8a to your computer and use it in GitHub Desktop.
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