Boolean Expressions and If Statements

# __**If Statements**__

* An *if* statement is just like it sounds. It’s a conditional statement that is used in Java to help control the flow of the program.
* For example, your parents tell you, you can only watch a movie __if__ you finish cleaning your room.
* Cleaning your room is the condition for you to be able to watch the movie.
* You won't get to go if you don’t clean your room.
* The else statement in the example below is used for what results to produce when the if condition isn’t being satisfied.
* Ex:

```java
int num1 = 4, num2 = 5;

if( num1 == num2)

System.out.print(“The numbers are the same.”);

else

System.out.print(“The numbers aren’t the same”);
```

* **Note**: The boolean operator( ==), isn’t the same as the assignment operator(=).
* A boolean operator asks a question, while an assignment operator executes a command. The boolean operator in this example determines if *num1* is equal to *num2.*
* The assignment statement doesn’t produce other results.

# __**Boolean Expressions**__
* **Values that can be compared using boolean statements:**
* `==`**(equal)**
* `!=`**(not equal)**
* `
robot