How to convert dictionary values to array in Swift

1 Answer

0 votes
let dic : [String: Int] = ["Swift": 4, "Python": 7, "Java": 6, "PHP": 5]
  
var arr = [Int](dic.values)

print(arr)
  
  
  
  
/*
run:
  
[6, 4, 7, 5]
  
*/

 



answered Sep 20, 2020 by avibootz

Related questions

2 answers 186 views
1 answer 201 views
201 views asked Sep 19, 2020 by avibootz
2 answers 262 views
1 answer 197 views
...