The "in" keyword, when used in expressions, is executed after assignments.
Numbered Steps to Reproduce Problem:
1) Make an expression that uses both an assignment and the in keyword, in the same expression
2) Compile
3) Execute
4) Notice how the assignment is done first, and the rest of the code is ignored
Code Snippet (if applicable) to Reproduce Problem:
We tried this code with the ss13 /tg/ IRC dm bot:
!dm var/a = "t";; var/list/L = list();; var/b = "abc";; b += a in L ? "test" : "";; b
and it returned "abct" when it should have returned "abc"
var/a = "t"
var/list/L = list()
var/b = "abc"
b = a in L ? "test" : ""
world << b
Expected Results:
I expected
a in L ? "test" : ""
b = ""
Actual Results:
b gets set to "t", aka
b = a
Does the problem occur:
Every time? Or how often? Everytime
In other games? unrelated
In other user accounts? unrelated
On other computers? Yes
When does the problem NOT occur?
Never
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
Haven't checked
Workarounds:
Parentheses can be used to force the expression to evalutate correctly, so you can do b = (a in L) ? "test" : "" so that the keyword "in" is evalutated before the assignment. But it shouldn't be required.
the rule is, if it's not in this list, it's lower than the lowest thing: