© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
8 replies
Groophy

✅ Simple question

I have a code which
if ("any" is "item1" or "item2" or "any")
{
    Console.WriteLine("okay");
}
if ("any" is "item1" or "item2" or "any")
{
    Console.WriteLine("okay");
}

that prints okay but out of curiosity, can I do this with symbols? like
if ("any" == "item1" || "item2" || "any") // "any" == "item1" || "any" == "item2" will be corrent but really bad readable
{
    Console.WriteLine("okay");
}
if ("any" == "item1" || "item2" || "any") // "any" == "item1" || "any" == "item2" will be corrent but really bad readable
{
    Console.WriteLine("okay");
}
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

simple algorithm question
C#CC# / help
2y ago
simple question [Answered]
C#CC# / help
4y ago
a simple question
C#CC# / help
4y ago