DarwinBotsManual
Open the app EspañolES

add

Adds the top two numbers of the integer stack and leaves the result.

Facts

Word
add
Family
Basic
Integer stack
pops 2, pushes 1
What it does
Pops two numbers and pushes their sum. Above 16,777,216 it loses precision, and past 2 billion it wraps around.
Cost
Basic command
Runs
inside a gene: in the condition (cond) and in the body (start or else)

a b add leaves a + b. It is plain old addition, with the usual order of DNA: first the two numbers, then the word.

WordStack after
33
43 4
add7

The most common use is adjusting a reading before storing it, or keeping a count in free memory. This bot adds 1 to cell 50 every cycle:

cond
start
  *50 1 add 50 store
stop

For that specific job there is a shortcut, inc (50 inc), which does the same with fewer words and for a tenth of the energy a store costs (see Execution and costs).

Two inherited quirks, which only show up with enormous numbers, beyond what fits in memory:

Subtraction, sub, behaves the same way.