You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Should probably print -1. Instead, I get "Cannot negate ListValue".
In the beginning I thought it is because kOS doesn't know what is the type of the object in the list (string couldn't be negated surely), but the very same code works if I switch from negating to multiplying by -1.
The text was updated successfully, but these errors were encountered:
Yes, you were right. Taking test[0] into brackets solves the issue. Perhaps the [] should have even bigger precedence? I don't think there's a situation when we want it the other way around: (-x)[15]. Either way, thanks for making it clear.
Dunbaratu
changed the title
"Cannot negate ListValue"
order of operations "-" vs "[..]"Cannot negate ListValue"
Feb 21, 2015
Dunbaratu
changed the title
order of operations "-" vs "[..]"Cannot negate ListValue"
order of operations "-" vs "[..]" (was: "Cannot negate ListValue")
Feb 21, 2015
The following code:
Should probably print -1. Instead, I get "Cannot negate ListValue".
In the beginning I thought it is because kOS doesn't know what is the type of the object in the list (string couldn't be negated surely), but the very same code works if I switch from negating to multiplying by -1.
The text was updated successfully, but these errors were encountered: