Learn
Conditionals
The βͺοΈ Statement

As we previously mentioned, we do things based on our present conditions. Like, if weβre hungry, weβd get something to eat; if itβs raining, we would carry an umbrella.

How our actions follow the same:

1. If thereβs some condition
2. Take some action

Using Emojicode, we can add this decision making ability into our program using the `βͺοΈ` statement. This `βͺοΈ` checks a condition and if the condition evaluates to `π`, it runs a block of code.

Take for instance:

``````βͺοΈ π π
π π€The condition is ππ€βοΈ
π

π­ Prints: The condition is π``````

Notice how we added the `π` after the `βͺοΈ`. Then we follow up with a block of code using `π` and `π`. Inside the block of code, we added `πβοΈ` to print out the string `π€The condition is ππ€`.

If we change the condition from `π` to `π` like so:

``````βͺοΈ π π
π π€The condition is ππ€βοΈ
π

π­ Nothing prints``````

Our code block doesnβt run since our condition is `π`. Therefore, we wouldnβt get anything printed to the terminal.

Letβs create our own conditional to see it in action.

### Instructions

1.

Add a `βͺοΈ` statement that accepts the condition `π`. Then, add an empty code block using `π` and `π`.

2.

Inside the code block, add a print statement using `πβοΈ` and print out a string of your choice! For example: `π€I'm π of the world!π€`.

3.

Now just play around with the code:

• Try changing the `π` to a `π`.
• Add in more `πβοΈ` statements.