How to sort a set in ascending order with Swift

1 Answer

0 votes
let st: Set = [6, 98, 10, 3342, 7, 21, 4]

let new_st = st.sorted(by: <)

print(new_st)



  
  
/*
run:
  
[4, 6, 7, 10, 21, 98, 3342]
 
*/

 



answered Jun 16, 2023 by avibootz

Related questions

1 answer 175 views
1 answer 187 views
1 answer 236 views
1 answer 81 views
1 answer 167 views
...