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

Related questions

1 answer 197 views
1 answer 198 views
198 views asked Sep 19, 2020 by avibootz
2 answers 262 views
1 answer 155 views
...