what is fallthrough? where is used? and y it is necessary? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

what is fallthrough? where is used? and y it is necessary?

20th Mar 2017, 12:06 PM
prashanth jerry
prashanth jerry - avatar
5 Answers
+ 15
In C they fall through in other words it behaves different to expectations Swift added fall through for those who know what to expect. From an anomaly to a function . Something to do with conditionals and loops continuing previous function while going to next function simultaneously
22nd Mar 2017, 6:02 PM
Shawn Gillis
Shawn Gillis - avatar
+ 15
Well, at least that is what I gathered from my studies
22nd Mar 2017, 6:04 PM
Shawn Gillis
Shawn Gillis - avatar
+ 11
the fallthrough keyword moves code execution directly to the statements inside the next (or default) case block. it is used when you want your code to continue execute the next code in switch statement. it is not necessery.
20th Mar 2017, 1:05 PM
Agus Mei
Agus Mei - avatar
+ 3
it's not always necessary,, in some cases you want to use fall through.
20th Mar 2017, 12:14 PM
Yuliana
Yuliana - avatar
+ 2
Use it when you need go to the next case in switch.
20th Mar 2017, 10:28 PM
Slawek