tisdag 2 oktober 2012

Switch statement a short snippet - C#

A switch statement can be very handy and use full if used right,
What it does it that it  handles multiple selections by passing control to one off it's case statement.


In the following snippet ,
We read what the user type. in using Console.ReadLine(); and transform that into a string we name sWhereToGo Then we passe the string to our tiny switch statement. That will print out some thing like the second image.

And below we have the snippet enjoy.


Pastebin (Snippet) : http://adf.ly/DMeqY

Inga kommentarer:

Skicka en kommentar