From 5cbe21754aa1de40f3bf1346fb08c24c61167071 Mon Sep 17 00:00:00 2001 From: FlyvendeThom Date: Sun, 14 Oct 2018 18:22:35 +0200 Subject: [PATCH] Switch Statements - Fallthrough (#18405) --- .../guide/english/csharp/switch-case/index.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/client/src/pages/guide/english/csharp/switch-case/index.md b/client/src/pages/guide/english/csharp/switch-case/index.md index 221dda067e..3b8d9ff327 100644 --- a/client/src/pages/guide/english/csharp/switch-case/index.md +++ b/client/src/pages/guide/english/csharp/switch-case/index.md @@ -45,5 +45,20 @@ If myColor is Colors.Orange: ``` +## Fallthrough + +It is also possible to use multiple statements produce the same outcome, by letting the cases 'fallthrough', like so: + +``` +switch(myColor) { + case Colors.Red: + case Colors.Blue: + //Code + break; + ... + } +``` +This will execute the same lines of code if myColor is either Red or Blue. + ### Sources: - 1 https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/switch