Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# switch case greater than

int mark = 50;
switch (mark)
{
    case int n when n >= 80:
        Console.WriteLine("Grade is A");
        break;

    case int n when n >= 60:
        Console.WriteLine("Grade is B");
        break;

    case int n when n >= 40:
        Console.WriteLine("Grade is C");
        break;

    default:
        Console.WriteLine("Grade is D");
        break;
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: save image in c# 
Csharp :: how to find current country c# 
Csharp :: power of number 
Csharp :: make variables in c# 
Csharp :: how to get current dir in c# 
Csharp :: how to write coroutine in unity 
Csharp :: C# clear form 
Csharp :: unity gui style color button 
Csharp :: Get the Photon Player GameObject 
Csharp :: c# encrypted 
Csharp :: how to add a force to an object unity 
Csharp :: mvc refresh page from controller 
Csharp :: published net core did not have wwwroot 
Csharp :: unity game object remove parent 
Csharp :: wpf textblock line break code behind 
Csharp :: stringify c# 
Csharp :: asp.net core 6 autofac 
Csharp :: get number of days between two dates c# 
Csharp :: unity switch to scene and transfer data 
Csharp :: c# Program to check if a given year is leap year 
Csharp :: finally c# code 
Csharp :: Oculus Unity button press 
Csharp :: c# const vs readonly 
Csharp :: color32 unity 
Csharp :: unity reflect raycast 
Csharp :: c# add strings 
Csharp :: adding to a dictionary unity 
Csharp :: c# linq select specific columns 
Csharp :: How to make a simple console select screen using C# ReadKey 
Csharp :: asp.net get most recent file in directory 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =