0
why dont work
3 ответов
+ 3
You don't have quotes around the values. The system is looking for the names of the colors as is they are variables.
For example...
You have: if(color==red)
Should be: if(color=="red")
+ 2
Have a look at what the error message says: "The name red does not exist in the current context."
Where did you define the color variables?
You may also want to have a look at this one:
https://learn.microsoft.com/en-us/dotnet/csharp/how-to/compare-strings
It explains how to compare strings in C#.
0
Thanks