If is a function or an operator in Python

Viewed 128

If is a function or an operator in Python. Just I am curious about it. In my opinion, it is a function because it gives output and accomplishes commands. I know that it is statement.

4 Answers

In python, if is a statement used for conditional execution. It's not considered a function nor an operator.

I don't think you 'll find a better answer than the python docs.

Considered if is built-in construction in the core of the language I think it can be considered less of a function but more an operator. If can be described as a set of instructions but at the high level (such as python) it's operator.

Related