0
Sorting in Swift [SOLVED]
Hello, I just played with this code but I really struggle to print the numbers in sorted order. Can someone help me out? let group1: Set = [1, 2, 3, 4, 5] let group2: Set = [3, 4, 5, 6, 7] let group3: Set = (group1.union(group2)) print(group3)
3 odpowiedzi
+ 1
You don't need group3:
let group1: Set<Int> = [1, 2, 3, 4, 5]
let group2: Set<Int> = [3, 4, 5, 6, 7]
print(group1.union(group2).sort())
0
Thank you, worked! :)
0
No Problem