# This content is archived!

For the 2018-2019 school year, we have switched to using the WLMOJ judge for lesson information, no new lessons will be added here.

Conditions can check if 2 values are equal, if a value is less than another, if a value is more than another, or a mixture of conditions.

If the condition is true, it will execute the code in the block below

For example, you can ask for the user’s age and see if they are an adult.

### Java

If you want a block of code to run if a condition is true, and want another block of code to run if that condition is not true, you can use an else along with the if statement

### Java

You can use else if (in some languages shortened to elif or elsif) to chain if statements together.

If the condition in the if statement is not true, then it checks for the condition in the next else if statement, then the next, and so on. If none of the if or else if statements are true, it goes to the else block (if there is one).

# Practice

Pick three random numbers from 1 to 10 and ask the user to enter a number between 1 and 10.

If the user guesses one of the three numbers you picked, tell they won, otherwise, tell them they lost.