Below is a variable assignment I found in a script which has made use of the and and or operators.
rightValue = (inputState == Enum.UserInputState.Begin) and -1 or 0
I could not find a simpler example of it being used and so I am really struggling to understand what it does.
Could someone explain to me what the and operator does, and what the or operator does when used in variable assignment?
Thank you to anyone who replies in advance!

4 comments
Full explanation under the relevant "and" and "or" sections here: http://lua-users.org/wiki/ExpressionsTutorial also, the Ternary article (what you're talking about): http://lua-users.org/wiki/TernaryOperator
If
inputStateis equal toBeginthenrightValuewill be -1, else it will be 0@Chess your link looks broken. Try this http://lua-users.org/wiki/ExpressionsTutorial
(I try to put links at the end of a comment so text after the link doesn't try to interfere with the URL)