Does swift have fall through statement? e.g if I do the following
var testVar = \"hello\"
var result = 0
switch(testVal)
{
case \"one\":
result = 1
case
Here is example for you easy to understand:
let value = 0
switch value
{
case 0:
print(0) // print 0
fallthrough
case 1:
print(1) // print 1
case 2:
print(2) // Doesn't print
default:
print("default")
}
Conclusion: Use fallthrough to execute next case (only one) when the previous one that have fallthrough is match or not.