I am programming a thing where I am asking a user to type in several ingridients, how much they want of it and what the kg/ml/liter/etc price is. So that I add all the cost values(after multiplying the cost per unit times the measure they want) later display for them the most cheap and expensive ones. This is done in Visual Studio and the language is in C#. So I am typing this:
static void Ingridiens()
{
string ingridiensen;
Console.Write("Vad för ingridiIngridiensens behöver du?\nIngridiens: ");
ingridiensen = Console.ReadLine();
listaformat.Add(ingridiensen);
PrisPerEnhetEtt(prisetPerEnhet);
}
Ignore the variable names since they are in swedish. What I want help in is to check whether the input of the user is letters or something else. If they are not letters like numbers or any other special characters I want to return an error. And I also want to check if they are typinh one letter or not. It is one letter I still wanna return an error. But if they both type in letters(i.e. at least 2 letters) than I want to move on to the next method which in my case is PrisPerEnhetEtt.
I am finding it hard to fix this. I tried a lot of stuff, if statements, switch statements but i seems i need to invoke boolean variables. I am not sure how to do it. I am quite new to programming.
Thanks for all the help! :D