Hello,
I am new to C# and currently learning.
I was hoping someone can assist me with the below as I am getting an error saying Invalid expression term '>' and Invalid expression term '<'.
Thank You.
I am new to C# and currently learning.
I was hoping someone can assist me with the below as I am getting an error saying Invalid expression term '>' and Invalid expression term '<'.
C#:
using System;
class Program
{
static void Main()
{
Console.WriteLine("Enter a number");
bool result;
result = int.TryParse(Console.ReadLine(), out int x);
if(result == true)
{
switch(x)
{
case > 10:
Console.WriteLine("Your number is {0} is bigger than 10", x);
break;
case < 10:
Console.WriteLine("Your number is {0} is smaller than 10", x);
break;
default:
Console.WriteLine("Your number is equal to 10");
break;
}
}
Thank You.