Reputation: 23
I get a SyntaxError
from this code:
if wallDirection = '-X':
xAxis = -buildingSectionWidth
What is wrong, and how do I fix it?
Upvotes: -1
Views: 766
Reputation: 30736
First see What is the difference between an expression and a statement in Python? An if
statement requires an expression as its condition.
wallDirection = '-X'
is a statement that assigns wallDirection
to the value -X
. The expression you likely want here is wallDirection == '-X'
. The operator that tests for equality is ==
, not =
.
if wallDirection == '-X':
xAxis = -buildingSectionWidth
Upvotes: 1