How to check if a key equal to specific value in dictionary with Swift

1 Answer

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

  
  
/*
run:
  
Value = 5

*/

 



answered Sep 20, 2020 by avibootz
...