So basically I forgot what the operator was and was wondering how you use “and or” as in the way of
“if transparency == 1 and 0 or 1 then” so I’m not sure how it’s used but it’s like a way to say if this then this but with and and or, can someone explain this to me and how it’s used? thanks.
I’m confused, how could transparency be 1 and 0 and the same time? But the logic would be like this:
if transparency == 1 and transparency == 0 or transparency == 1 then
but it doesn’t make any sense.
I think that you are refering to the ‘ternary operator’.
local condition = false
local whenTrue = 1
local whenFalse = 21
local test = condition and whenTrue or whenFalse
print(test)
Outputs 21.
this would give an error due to no use of ==
besides even with an == it would always run because of the “or 1”
the “or 1” would work when defining variables
It was a example yeah I didn’t add 2 ='s but I was just trying to get the point across.
yeah can you explain exactly how this works?
ok thanks I’ll take a look at that
This behavior is due to how and and or work.
and will only happen when both arguments are true, but it will bias the second value. Now if both values are false that feeds into the or statement which will bias the truthful value first.
It really just comes down to understanding how these operators work. The article @Brickman808 attached will provide the best information on this, but it basically functions like an if else statement. So it’s more of a preference to use it.
alright I appreciate it thankyou