I Haz Codes

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Menu
Using ==
Using other conditions
elif and else
IF statements

About IF

If statements allow you to change the flow of your program. It allows you to test a condition, test what the user has entered or evaluate the current state of your variables. Fundamentally an if statement will allow you to run specific code if a condition is true or not. The condition must evaluate to either true or false. There are no other possible choices.

To support your learning, I have broken the IF statement topic into multiple parts.

Using ==

Learn When starting to learn about if statements it is important to get to grips with the basic syntax and terminology. Also, you need to understand the difference between = and ==. In python a single = is used to assign values to a variables while == is used to check if two things are […]

Using other conditions

Learn So far we have only explored the == operator. In this session we will look at the other operators and see how they can be used within your programs. This video will also look at character encoding to help understand how we can use greater/less than with text. Try You need to write a […]

elif and else

Learn The final part of IF statements is to look at how we can make use of elif and else. Else allows us to do something when the condition is false. Elif allows us to daisy chain multiple if statements together but only allowing one of them to be true. Try You need to write […]

Helpful links

TODO

Leave a Reply

Your email address will not be published. Required fields are marked *

Information