This page demistrates "if" statements and how they can be used.

What can be used in an "if" Statement:

Greater than
(>)
Less than
(<)
Equal to
(==)
Greater than or Equal to
(>=)
Less than or Equal to
(<=)
NOT Equal to
(!=)

Used to join statements inside of an "if" Statement:

and
(&&)
or
(||)

Don't forget curly braces ({}) when you have more than one statement in your "if"!

Code Output

**Note: The examples on the right actually work. Try them!!

code

Example: How "if" Statements work


Enter a number between one and ten!

Enter a number (i.e 2):


*Note: Since you only have one line of code under the "if" you DO NOT need curly braces ({}).

code

Example: How "if" Statements work


Enter a number between one and ten!

Enter a number (i.e 2):


*Note: Since you only have one line of code under the "if" you DO NOT need curly braces ({}).

code

Example: How "if" Statements work


Enter a number between one and ten!

Enter a number (i.e 2):


*Note: Since you only have one line of code under the "if" you DO NOT need curly braces ({}).

code

Example: How "if" Statements work


Enter the number one: