this post was submitted on 04 Jul 2023
10 points (85.7% liked)
.NET
1484 readers
15 users here now
Getting started
Useful resources
IDEs and code editors
- Visual Studio (Windows/Mac)
- Rider (Windows/Mac/Linux)
- Visual Studio Code (Windows/Mac/Linux)
Tools
Rules
- Rule 1: Follow Lemmy rules
- Rule 2: Be excellent to each other, no hostility towards users for any reason
- Rule 3: No spam of tools/companies/advertisements
Related communities
Wikipedia pages
- .NET (open source & cross platform)
- .NET Framework (proprietary & Windows-only)
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
A switch statement will let control fall through. A switch expression will no, and will throw an exception (and there will also be a compiler warning that it's not exhaustive before you even run the code)
I think even
switch
statement doesn't allow it because every case needs to be terminated with eitherbreak
,return
orraise
. One needs to usecase goto
if one wants fall thought like behavior:A
switch
statement allows fall through when the case itself doesn't have an implementation.For example this is also considered a fall through:
TIL!!!
Thank you!