Difference between revisions of "Or"
Jump to navigation
Jump to search
Line 25: | Line 25: | ||
print A < minimum or B < maximum // output : 0 | print A < minimum or B < maximum // output : 0 | ||
</ms> | </ms> | ||
+ | |||
+ | See also: [[and]], [[not]], [[Fuzzy Logic]]. | ||
[[Category:Language]] | [[Category:Language]] | ||
[[Category:Keywords]] | [[Category:Keywords]] |
Latest revision as of 20:40, 29 January 2025
or
is a keyword for logical binary operator of disjunction (or) of boolean algebra and Fuzzy Logic. It evaluates two operands and returns true
when at least one of the operands is true
, else it returns false
.
More specifically, a or b
(where a and b are numbers) evaluates to the absolute value of the expression a + b - (a * b)
, clamped to the range 0 - 1.
Examples
print false or false // output : 0
print false or true // output : 1
print true or false // output : 1
print true or true // output : 1
print 0.8 or 0.5 // output : 0.9
a = false
b = true
c = false
print a or b // output : 1
print b or c // output : 1
print a or c // output : 0
minimum = 3
maximum = 7
A = 4
B = 9
print A > minimum or B < maximum // output : 1
print A < minimum or B < maximum // output : 0
See also: and, not, Fuzzy Logic.