what is the difference between = and ==
and the difference between elif and else
I’ll assume you’re referring to python. When all else fails it helps to remember that google is your friend as is the documentation for the programming language. elif
and else
are used in control flow statements (used with if
statements for conditional execution. else
is optional).
See:
https://docs.python.org/3.10/tutorial/controlflow.html?highlight=control%20flow
and:
https://docs.python.org/3.10/reference/compound_stmts.html#elif
The single =
is used to assign a value to a variable.
ex: x = 'cat'
The double ==
is used to check equality (or used in comparison), or, an equality operator.
ex: if y == z....do this, etc.
1 Like
yes thank you very much
2 Likes
This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.