If statement conditions are standard boolean expressions and values

suggest change

The following statement

if (conditionA && conditionB && conditionC) //...

is exactly equivalent to

bool conditions = conditionA && conditionB && conditionC;
if (conditions) // ...

in other words, the conditions inside the “if” statement just form an ordinary Boolean expression.

A common mistake when writing conditional statements is to explicitly compare to true and false:

if (conditionA == true && conditionB == false && conditionC == true) // ...

This can be rewritten as:

if (conditionA && !conditionB && conditionC)

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Conditional Statements:
* If statement conditions are standard boolean expressions and values

Table Of Contents
3 Conditional Statements
17 Regex
19 Arrays
21 Enum
22 Tuples
24 GUID
27 Looping
36 Casting
46 Methods
88 Events
92 Structs
104 Indexer
106 Stream
107 Timers
109 Threading
127 Caching
135 Pointers
147 C# Script