Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

switch expression c#

//called: switch expressions

int number= 2;

string result = number switch
{
    0 => "zero",
    1 => "one",
    2 => "two",
    _ => "default"
};

Console.WriteLine(result);
 
PREVIOUS NEXT
Tagged: #switch #expression
ADD COMMENT
Topic
Name
6+3 =