I am creating a "Basic Search" bar that users can type in terms. I am unsure of the order of operations for boolean logic.
If someone types terms(With no quotes):
A and B or C
What is the correct way to treat this?
(A and B) or (C)
OR
(A) and (B or C)
The three basic boolean operators are: AND, OR, and NOT.
Boolean Operators are simple words (AND, OR, NOT or AND NOT) used as conjunctions to combine or exclude keywords in a search, resulting in more focused and productive results.
Wikipedia to the rescue, this should help:
http://en.wikipedia.org/wiki/Order_of_operations#Programming_languages
From the looks of things, it would appear that AND
takes precedence over OR
in most languages.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With