# Need help understanding some operators

#### idlehands

##### New Coder
Hi All,

I am studying LUA scripting and came across a string of codes that I can't understand. Was hoping anyone here can help me understand this:

local B = C - D
B = B < -1 and -1 or 1 or B
B = math.floor(B * 1000) / 1000
B = B + 0.3 * (1 - math.sin(B * 3.14 / 2)) + 0.2

The line I am unable to understand is this:
B = B < -1 and -1 or 1 or B

What does this mean?
Is it defining the value of B?

Thanks a lot for the help!

#### LTomy

##### Active Coder
Staff Team
Guardian
Hi idlehands,

The line does not seem to make much sense to me.

From what I understand, in english, it means:
Set the value of 'B' to True if:
B is smaller than -1 AND if -1 equals True OR if 1 equals True OR if B equals True.
Otherwise, set 'B' to False.

#### idlehands

##### New Coder
Hi idlehands,

The line does not seem to make much sense to me.

From what I understand, in english, it means:
Set the value of 'B' to True if:
B is smaller than -1 AND if -1 equals True OR if 1 equals True OR if B equals True.
Otherwise, set 'B' to False.
Thanks a lot for the explanation!
If you don't mind, can I would like to ask additional clarifications:
1. Does it mean that if the value of B becomes less than -1, it will be equal to -1?
2. If value of B >1, then it will be equal to whatever it is?
Sorry to bother. Currently trying to learn.

Thanks!