If Statements
If Statements
Conditionals: Features of programming language that allows different computations to occur based on decision making.
Conditionals are dependent on Boolean expressions that are evaluated to True or False.
Different texts will define conditionals to be statements, expressions, or constructs.
The use of conditionals is the way to control the flow of a program.
if
statement
if
statementif
is a built-in keyword in Python that allows us to write conditional statements.if statements will only execute their own block of code if its boolean condition evaluates to True.
if the boolean condition doesn’t evaluate to True, the program will skip its block of code
Block of code or Code Block in python are started by a (:) colon and indentation. (Examine the example below)
Last updated