"switch/case with numeric range" Code Answer's

You're definitely familiar with the best coding language C# that developers use to develop their projects and they get all their queries like "switch/case with numeric range" answered properly. Developers are finding an appropriate answer about switch/case with numeric range related to the C# coding language. By visiting this online portal developers get answers concerning C# codes question like switch/case with numeric range. Enter your desired code related query in the search bar and get every piece of information about C# code related question on switch/case with numeric range. 

switch case c# range

By Quaint QuollQuaint Quoll on Mar 26, 2020
int i = 63;

switch (i)
{
    case int n when (n >= 100):
        Console.WriteLine($"I am 100 or above: {n}");
        break;

    case int n when (n < 100 && n >= 50 ):
        Console.WriteLine($"I am between 99 and 50: {n}");
        break;

    case int n when (n < 50):
        Console.WriteLine($"I am less than 50: {n}");
        break;
}

Source: stackoverflow.com

Add Comment

3

switch/case with numeric range

By Creepy GáborCreepy Gábor on Dec 08, 2020
function getCategory(age) {  
    var category = "";  
    switch (true) {  
        case isNaN(age):  
            category = "not an age";  
            break;  
        case (age >= 50):  
            category = "Old";  
            break;  
        case (age <= 20):  
            category = "Baby";  
            break;  
        default:  
            category = "Young";  
            break;  
    };  
    return category;  
}  
getCategory(5);  // will return "Baby"

Source: stackoverflow.com

Add Comment

0

All those coders who are working on the C# based application and are stuck on switch/case with numeric range can get a collection of related answers to their query. Programmers need to enter their query on switch/case with numeric range related to C# code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about switch/case with numeric range for the programmers working on C# code while coding their module. Coders are also allowed to rectify already present answers of switch/case with numeric range while working on the C# language code. Developers can add up suggestions if they deem fit any other answer relating to "switch/case with numeric range". Visit this developer's friendly online web community, CodeProZone, and get your queries like switch/case with numeric range resolved professionally and stay updated to the latest C# updates. 

C# answers related to "switch/case with numeric range"

View All C# queries

C# queries related to "switch/case with numeric range"

Browse Other Code Languages

CodeProZone