Professional Documents
Culture Documents
If Statement
If Statement
In this example, if the value of the number variable is greater than 5, the message "The
number is greater than 5." will be printed to the console. If the condition is false, the
message will not be printed.
You can also use an else block to specify what should happen when the condition is
false:
In this case, if the number is less than or equal to 5, the message "The number is not
greater than 5." will be printed.