Difference between revisions of "And"
Jump to navigation
Jump to search
Line 26: | Line 26: | ||
</ms> | </ms> | ||
− | See also [[Fuzzy Logic]]. | + | See also: [[or]], [[not]], [[Fuzzy Logic]]. |
[[Category:Language]] | [[Category:Language]] | ||
[[Category:Keywords]] | [[Category:Keywords]] |
Latest revision as of 20:39, 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
print 0.8 and 0.5 // output : 0.4
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: or, not, Fuzzy Logic.