Main About Download Schemes Documentation Resources

If Shape

Default Appearance

What it Does

An If Statement checks a Boolean expression and then executes a true or false branch based on the result.


The example, to the right, declares an integer called 'age'. It then reads the age from the keyboard.

Finally, an If Statement checks if the age is greater than or equal to 18. Based on this, it either takes the false branch and displays "Sorry, not yet", or takes the true branch and displays "Go vote!".