What does “control falls through a switch statement” mean in this context? Control just moves on to the next statement?
I thought if there is no match and a default case doesn’t exist it will raise an exception. Is it not true?
What does “control falls through a switch statement” mean in this context? Control just moves on to the next statement?
I thought if there is no match and a default case doesn’t exist it will raise an exception. Is it not true?
A
switch
statement allows fall through when the case itself doesn’t have an implementation.For example this is also considered a fall through:
switch (x) { case "One": case "Two": Console.WriteLine("One or two"); break; }
TIL!!!
Thank you!