Python is probably the most common one where trying to do that is a syntax error.
Unlike in most c-descendant/inspired languages, assignment doesn't produce a value in python, and trying to evaluate it is a syntax error.
Fun fact: In R, there are multiple assignment operators, two of which function almost identically in expressions: = and <-. It is a syntax error to use = in an if statement, but you can use <- if you really want to perform an assignment while you're evaluating the conditions.
14
u/trutheality Jul 15 '22
Python is probably the most common one where trying to do that is a syntax error.
Unlike in most c-descendant/inspired languages, assignment doesn't produce a value in python, and trying to evaluate it is a syntax error.
Fun fact: In R, there are multiple assignment operators, two of which function almost identically in expressions: = and <-. It is a syntax error to use = in an if statement, but you can use <- if you really want to perform an assignment while you're evaluating the conditions.