0

When executing my code below I get a syntax error:

expected an indented block

I have checked the tabs are not spaces as suggested on other threads. What is causing this?

if wallDirection = '-X':
    xAxis = -buildingSectionWidth
Chris Martin
  • 30,334
  • 10
  • 78
  • 137
JacksonDavis
  • 25
  • 1
  • 3

1 Answers1

2

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
Chris Martin
  • 30,334
  • 10
  • 78
  • 137
  • Dude, thank you so much. I was using == earlier in my code, but never fully understood its effect. I certainly never thought that would be the problem behind it. The code works really well now. Thanks for the help! – JacksonDavis May 02 '16 at 00:42