From 5ddb0592428a60b59eda7010b7ab903c81a4bf5c Mon Sep 17 00:00:00 2001 From: justingiffard Date: Wed, 21 Nov 2018 16:58:23 +0200 Subject: [PATCH] Made pretty and clarified (#22392) * fixed indentations, added line breaks * split the 3 switch case output examples and specified in which situation they would be executed --- guide/english/csharp/break/index.md | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/guide/english/csharp/break/index.md b/guide/english/csharp/break/index.md index 94dab17fe2..0dc09f694d 100644 --- a/guide/english/csharp/break/index.md +++ b/guide/english/csharp/break/index.md @@ -13,11 +13,8 @@ In the first example, when the value of i is 3, the break statement is executed, int[] array = { 1, 2, 3, 4, 5 }; for (int i = 0; i < array.Length; i++) { - if(i == 3) - { - break; - } - Console.WriteLine("Item on index {0} is {1}", i, array[i]); + if(i == 3) break; + Console.WriteLine("Item on index {0} is {1}", i, array[i]); } ``` @@ -37,12 +34,15 @@ switch (exampleVariable) Console.WriteLine("case 1"); Console.WriteLine("This only shows in example 1"); break; + case 2: Console.WriteLine("case 2"); Console.WriteLine("This only shows in example 2"); - Console.WriteLine("This also only shows in example 2"); + Console.WriteLine("This also only shows in example 2"); break; + Console.WriteLine("This would not show anywhere, as it is after the break line and before the next case"); + default: Console.WriteLine("default"); Console.WriteLine("This only shows in the Default Example"); @@ -52,15 +52,19 @@ switch (exampleVariable) ``` ## Output: +#### Executed with `exampleVariable = 1` ``` > case 1 > This only shows in example 1 -> +``` +#### Executed with `exampleVariable = 2` +``` > case 2 > This only shows in example 2 > This also only shows in example 2 -> +``` +#### Executed with `exampleVariable = 3` or any other number +``` > default > This only shows in the Default Example -> ```