Swift - Control Flow
You want to print all numbers from a matched case up to 5 in a Swift
switch. Which code correctly uses fallthrough to achieve this?let num = 3
switch num {
case 1:
print(1)
fallthrough
case 2:
print(2)
fallthrough
case 3:
print(3)
fallthrough
case 4:
print(4)
fallthrough
case 5:
print(5)
default:
print("Done")
}