How to determine if dictionary contains specific keys in Swift

1 Answer

0 votes
var dic : [String: Int] = ["Swift": 4, "Python": 7, "Java": 6, "PHP": 5]
  
if dic["PHP"] != nil {
    print("Dictionary contains PHP")
}

  
  
/*
run:
  
Dictionary contains PHP

*/

 



answered Sep 20, 2020 by avibootz
...