C Sharp Programming/Keywords/if

The keyword identifies an  statement with the following syntax:
 * if-statement ::= "if" "(" condition ")" if-body ["else" else-body]
 * condition ::= boolean-expression
 * if-body ::= statement-or-statement-block
 * else-body ::= statement-or-statement-block

If the condition evaluates to, the if-body executes. Curly braces ("{{C sharp|{}}" and "}") allow the if-body to contain more than one statement. Optionally, an clause can immediately follow the if-body, providing code to execute when the condition is false. Making the else-body another statement creates the common cascade of, , , ,  statements:

The boolean expression used in an statement typically contains one or more of the following operators:

See also C Sharp Programming/Keywords/else.

/Keywords