Login Menu with user inputs

You mean ASCII table? This is my only class left and I never understood that table :sweat_smile:

Strings are made up of chars. If you don’t know, a char is identical to a byte (or a number from 0-255). So a way you can look at it is that your string is made up of bytes. Every byte represents one letter.

if ('g' == 103) Console.WriteLine("g is the same as 103");

It’s not important to memorize this table, but it’s good to have it around in fringe cases.

Note that all strings use ASCII, although it is outdated. ASCII is limited to 256 characters, utf-8 can have 2,097,152 different characters. That’s why you can use many more different kinds of characters on websites than you can in your C# program. :slight_smile:

I tried to make that simplification bug I am getting this error

That is because you are using strings instead of chars. You can’t compare strings with > < because they aren’t numerical values.

I’m a bit surprised that the exception was thrown, but it’s a good thing that it was.

In some languages you CAN compare strings using < and >, but you REALLY don’t want to be doing that unless you know what will happen and explicitly WANT that behavior. The order of numbers, letters, and symbols basically follows ASCII value tables, and that’s almost never what is desired. After all, is “A” really less than “a” and greater than “1”?

Evaluating equality with strings is safe. Evaluating > and < with strings seems likely to always have undesirable edge cases.

If you wanted to do that you could convert a single character string to a char like so

char.Parse(KEY) >= 'A'
//OR 
KEY.ToCharArray()[0] >= 'A'

Notice the single quotes around the A because it’s a char not a string.