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)

27th Jun 2018, 3:46 PM
LukasP
LukasP - avatar
3 ответов
+ 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())
27th Jun 2018, 6:39 PM
AshBreez450
AshBreez450 - avatar
0
Thank you, worked! :)
27th Jun 2018, 7:48 PM
LukasP
LukasP - avatar
0
No Problem
27th Jun 2018, 8:02 PM
AshBreez450
AshBreez450 - avatar