Shouldn't this be working?

In this Tic-Tac_Toe exercise from BJC it is suggested to create a Boolean switch to see if the empty square is already filled with a "x" or a "o". When I start this game the variable X's turn? is set to False and in my opinion shouldn't be executed within the if/else conditional statement beneath the "When I am clicked" and should only return "Foo". But...it doesn't...Am I missing something?

Well, the first thing I think you're missing is that in Tic-Tac-Toe, X plays first.

I'm having trouble reading your mind about this code. You say the IF/ELSE "shouldn't be executed" but one or the other branch will always be executed! So, if you start with X's turn False, you should expect the square to switch to costume O, which it does, and the variable to become True.

(By the way, you can just say
untitled script pic
The comparison against True is redundant.)

Can you clarify what you are expecting to happen, and why?

Thank you for the explanation. I was testing en evaluating blocks and got little bit carried away. What I thought should happen: when the green flag is clicked the variable X's turn is set to False -> within the When I am clicked it should not evaluate to True because the header of the if statement the condition X's turn? is explicitly set to met True. If this statement can't be met is wat makes the if/else statement obsolete?
In short: I could delete the if/else statement completely and should get the same result...this did not happen.

Oh! I think I can read your mind now.

Your mind has been injured by exposure to bad programming languages that use the symbol "=" as an assignment operator. There's no excuse for this language-design malpractice. "=" means "equals." It's a predicate, a function whose return value is True or False.

In Snap! we do assignment with the SET block. You clearly know this, because you used it in your green-flag script. But in reading your own code in the IF/ELSE block, you are reading "x = True" as if it were an assignment.

Thanks Brian, that completely clarifies it. :exploding_head: