DarwinBotsManual
Open the app EspañolES

or

Replaces the top two values of the boolean stack with one: true if either is. The only way to ask for “this or that”.

Facts

Word
or
Family
Logic
Boolean stack
pops 2, pushes 1
What it does
Pops two values from the boolean stack and pushes true if either is true. With only one, or with an empty stack, it pushes true.
Cost
Logic
Runs
inside a gene: in the condition (cond) and in the body (start or else)

or pops the top two values of the boolean stack and pushes true if either of them (or both) is true. It only gives false if both are false.

It's the logic operator you need most, because between cond and start the and is automatic but the or is not. This bot flees backwards (.dn) if it has little energy (.nrg) or if what it sees has more eye reads in its DNA than it does (.refeye, .myeye), a rough way of sizing up the other bot:

' backs off if it is weak or if the other looks bigger
cond
  *.eye5 0 >
  *.nrg 500 <
  *.refeye *.myeye >
  or
start
  20 .dn store
stop

or combines only the top two; the .eye5 condition lower down is left for start, which joins it with and. It reads: “sees something, and (is weak or the other looks bigger)”.

With an empty stack it also pushes true. For the bitwise or between numbers there is |; the or that excludes the case of both being true is xor.