Talk:Or operator
From Legacy Roblox Wiki
Jump to navigationJump to search
or isn't limited to if statements. Needs examples of other users, such as y = nil; x = y or 5, and then x is 5 not nil.
Trappingnoobs (Writer) Come check out my User page!
- What is the purpose of this page? We shouldn't make a page on a specific operator (unless there is a lot to it). For instance, rather than make a page on or, make a page on logical operators and a page on ternary.
-
- Logical operators should be part of the Boolean page. However,
and</syntaxhighlight> and
or</syntaxhighlight>, in Lua, are not strictly logical operators. This should be made clear somewhere.
- They definitely shouldn't be in the boolean page. Why would they go there? Just make a page on Ternary :/
- Couple of mistakes you've made. Firstly, by definition, logical operators apply to logical values, that is booleans. So therefore, logical operators, being boolean operators, should be on the boolean page. The issue here is that lua's
and</syntaxhighlight> and
or</syntaxhighlight> operators are not truly logical operators, since they do not always return booleans. So I guess a separate page would be handy.
- The more important point is that
a and b or c</syntaxhighlight> is NOT "the ternary operator", just like in C, where
a ? b : c</syntaxhighlight> is NOT "the ternary operator". In C, it is "the conditional operator", which happens to be a ternary operator, since it takes three operands. In lua, it's not even an operator - it's just an idiom. If I had to name it, I'd go with "the conditional idiom"
- Then they shouldn't go on the boolean page; you contradicted yourself. If they aren't boolean operators, they shouldn't be on the boolean page. Also, that's a name I approve of; furthermore, we should make a ternary page, anyway. It isn't like that would harm anything. One last question: if or is "the conditional idiom" then would that make and "the requirement idiom"?
- It's the combination of and and or that makes the conditional idiom.
- Then they shouldn't go on the boolean page; you contradicted yourself. If they aren't boolean operators, they shouldn't be on the boolean page. Also, that's a name I approve of; furthermore, we should make a ternary page, anyway. It isn't like that would harm anything. One last question: if or is "the conditional idiom" then would that make and "the requirement idiom"?
- Couple of mistakes you've made. Firstly, by definition, logical operators apply to logical values, that is booleans. So therefore, logical operators, being boolean operators, should be on the boolean page. The issue here is that lua's
- They definitely shouldn't be in the boolean page. Why would they go there? Just make a page on Ternary :/
- Logical operators should be part of the Boolean page. However,