Skip to content

Instantly share code, notes, and snippets.

@luisdeol
Created November 29, 2017 10:44
Show Gist options
  • Select an option

  • Save luisdeol/e8c4ca154ae2c4ab3f2a1b11acb69268 to your computer and use it in GitHub Desktop.

Select an option

Save luisdeol/e8c4ca154ae2c4ab3f2a1b11acb69268 to your computer and use it in GitHub Desktop.
Using the Switch statement
namespace implement_program_flow
{
class Program
{
static void Main(string[] args)
{
// The Switch Statemenet
var rankingPosition = 1;
switch (rankingPosition)
{
case 1:
Console.WriteLine("Golden medal!");
goto case 2;
case 2:
Console.WriteLine("Silver medal!");
goto case 3;
case 3:
Console.WriteLine("Bronze medal!");
break;
default:
Console.WriteLine("Do not get sad! Let's strive to get prepared for the next contest!");
break;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment