Using AND / OR

Hi! Basic question about AND/OR functions within IF node. In this n8n beginner tutorial, why does ‘AND’ work instead of ‘OR’? Even Maxim makes a mistake at first…

If the task is to take a set of e-mails and filter out any that contain “gmail” or “hotmail,” my initial instinct would be to use OR as well.

Thanks!

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

hello @artificialcreative

That’s how the binary logic works.
If you use OR condition, any email will match the filter “NOT gmail OR NOT hotmail IS true”

because a gmail domain will evaluate the statement as “false OR true IS true” which is always true
the same for hotmail domain - "true OR false IS true "

More context is here
Logical disjunction - Wikipedia
Logical conjunction - Wikipedia

1 Like

Thanks for the explanation and the Wiki reference - super helpful!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.