Q:

Why does Swift give me an EXC_BAD_INSTRUCTION here?

When executed in the playground, the following piece of code causes a EXC_BAD_INSTRUCTION:
func greet(person: [String:String]?, age: Int?) {
    guard let name = person!["name"] where person != nil else {
        return
    }
}

greet(nil, age: nil)

Can anyone tell me what's going on?

A:

The exclamation mark after person unwraps the optional which causes the crash because person is nil.
When you use optional binding you can omit the explicit checking for nil.
func greet(person: [String:String]?, age: Int?) {
  guard let name = person?["name"] else {
    return
  }
}

