 Anyone Can Code.

## if

### Avi Bhattacharya

`if` is used before a condition to check create the first condition within a conditional construct. If it is satisfied, then the code within the `if` statement will be executed.

``````
x = 18
if x > 10:
print ('value greater than 10')
```
value greater than 10
```

``````
#Using booleans
y = True
if y == True:
print('success')
```
success
```

You can also use the logical operators `and` and `or` to create more than one condition since these operators return boolean values.

``````
x = 39
if x < 10 and x >= 0: #ignore negative values for now
print('number has a single digit')
elif (x >= 10 and x < 100):    #you can break this line down to 'else, if x is greater than or equal to 10 and less than 100':
print ('number has two digits')
```
number has two digits
```

That's it for this tutorial! Click Next to access the next tutorial!

## Next ❯

Copyright © 2020, Q-Programming | Created by Arjun Sodhi, Balpreet Juneja and Sammarth Kumar | Developed and Designed by Sammarth Kumar