// check if the bool value is true
if (ExampleBool)
// check if the bool value is false
if (!ExampleBool)
–
Explicit check. Considered a bad practice in general, because it adds in an unnecessary code and usually leads to bad readability. Moreover, in some languages and circumstances the result might be complete opposite. Also, it’s very vulnerable to typos.
// check if the bool is equal to true
if (ExampleBool == true)
// check if the bool is equal to false
if (ExampleBool == false)
// check if the bool is not equal to true
if (ExampleBool != true)
// check if the bool is not equal to false
if (!ExampleBool != false)
–
Completely wrong usage:
if (ExampleBool = true)
Usually it is a result of the typos mentioned earlier. When you type =instead of == you tell the computer to process the expression inside the parentheses and check if the result is true, the computer performs the operation: set ExampleBool to true ( ExampleBool = true) and check if the result of the operation is true: yeah, the operation was success therefore it’s true, and it doesn’t matter what value the ExampleBool has actually.
–
PS advice: read some books or at least some basic programming tutorials to learn these very basic and fundamental things like the difference between the assignment operator = and the equation check operator ==.