I think it is far more clear to use optional binding so that the println is only invoked when there is an actual value to print
func getApple(appleId: String) {
if let apples = userDefaults.dictionaryForKey("apples_array") {
println(apples[appleId])
}
}