Proposal: and if #8602
Unanswered
Astrovolts
asked this question in
Language Ideas
Replies: 3 comments 1 reply
-
C# already has if (dog && brown && tail) Can you use that? |
Beta Was this translation helpful? Give feedback.
0 replies
-
If you have incrementally more actions depending on each condition: if (dog)
{
Console.WriteLine("It is a dog.");
if (brown)
{
Console.WriteLine("The dog is brown.");
if (tail)
{
Console.WriteLine("The dog has a tail.");
}
}
} And if you don't, just merge the nested |
Beta Was this translation helpful? Give feedback.
0 replies
-
P.S.: I don't like Python, but love when I can make blocks without braces and pretend that it's Python. Also:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Good day Gentlemen,
My suggestion is to implement an
and if
into C#; opposite of theelse if
statement.Traditional nested if statements:
This quickly becomes deeply nested and hard to follow as conditions grow.
Using and if to avoid nesting:
Beta Was this translation helpful? Give feedback.
All reactions