Difference between revisions of "And"
Jump to navigation
Jump to search
(Created page with "<c>and</c> is a keyword for logical binary operator of conjunction (and) of [https://en.wikipedia.org/wiki/Boolean_algebra boolean algebra]. It evaluate...") |
|||
| Line 1: | Line 1: | ||
| − | <c>and</c> is a [[:Category:Keywords|keyword]] for logical binary operator of conjunction (and) of [https://en.wikipedia.org/wiki/Boolean_algebra boolean algebra]. It evaluates two operands and returns <c>true</c> only when both operands are <c>true</c>, else it returns <c>false</c>. | + | <c>and</c> is a [[:Category:Keywords|keyword]] for logical binary operator of conjunction (and) of [https://en.wikipedia.org/wiki/Boolean_algebra boolean algebra] and [[Fuzzy Logic]]. It evaluates two operands and returns <c>true</c> only when both operands are <c>true</c>, else it returns <c>false</c>. |
| + | |||
| + | More specifically, <c>a and b</c>, where ''a'' and ''b'' are numbers, evaluates to the absolute value of the product <c>a * b</c>, clamped to the range 0 - 1. | ||
== Examples == | == Examples == | ||
| Line 22: | Line 24: | ||
print B > minimum and B < maximum // output : 0 | print B > minimum and B < maximum // output : 0 | ||
</ms> | </ms> | ||
| + | |||
| + | See also [[Fuzzy Logic]]. | ||
[[Category:Language]] | [[Category:Language]] | ||
[[Category:Keywords]] | [[Category:Keywords]] | ||
Revision as of 20:35, 29 January 2025
and is a keyword for logical binary operator of conjunction (and) of boolean algebra and Fuzzy Logic. It evaluates two operands and returns true only when both operands are true, else it returns false.
More specifically, a and b, where a and b are numbers, evaluates to the absolute value of the product a * b, clamped to the range 0 - 1.
Examples
print false and false // output : 0
print false and true // output : 0
print true and false // output : 0
print true and true // output : 1
a = true
b = false
c = true
print a and b // output : 0
print b and c // output : 0
print a and c // output : 1
minimum = 3
maximum = 7
A = 4
B = 9
print A > minimum and A < maximum // output : 1
print B > minimum and B < maximum // output : 0
See also Fuzzy Logic.