I have a problem with my switch statement. I don't know how to use it properly in c#. It gives me the error CS0150 and I don't know how to care with that. I appreciate any help. Thank you. The code is cut. If you see less brackets than normal, please don't remind me.
int e = 0;
string caseslol;
string multi = "multi";
Console.WriteLine("Hi there!");
Console.WriteLine("Do you want to write a number so I can do cool things with it ??");
Console.WriteLine("Write yes to say YES and no to say NO");
string str1 = Console.ReadLine();
if (str1.Contains("yes") == true)
{
Console.WriteLine("Enter it please");
e = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("lol, we got it!");
Console.WriteLine("you wrote this : {0}", e);
Console.WriteLine("Now that we got it, we can do cool stuff!");
Console.WriteLine("Do you want to know what is this stuff ???");
string yesorno = Console.ReadLine();
if (yesorno.Contains("yes") == true)
{
Console.WriteLine("OK");
Console.WriteLine("We can do calculating stuff with your number");
Console.WriteLine("Soo much cool, right ???");
string yesorno2 = Console.ReadLine();
if (yesorno2.Contains("yes"))
{
Console.WriteLine("Choose first another number and write it");
int b = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("So let's start with what ???");
switch (caseslol)
{
case multi:
Console.WriteLine(e * b);
}
}
}
//this is the output :
error CS0150:A constant value is expected
Compilation failed: 1 error(s), 0 warnings
compiler exit status 1