DarwinBotsManual
Open the app EspañolES

over

Copies the second number of the integer stack to the top: a b over leaves a b a.

Facts

Word
over
Aliases
overint
Family
Basic
Integer stack
pops 2, pushes 3
What it does
Copies the second item to the top: a b becomes a b a. With a single number it pushes a 0; with an empty stack it does nothing.
Cost
Basic command
Runs
inside a gene: in the condition (cond) and in the body (start or else)

a b over leaves a b a: it copies the one below the top and puts it on top, without popping anything. You can also write it as overint. It's like a dup of the second one, useful when a value is needed again but something is already on top of it.

WordStack afterwards
77
37 3
over7 3 7
cond
start
  7 3 over 50 store 51 store 52 store
stop

The three stores pop from the top down: cell 50 ends up at 7, cell 51 at 3 and cell 52 at 7.

An inherited quirk: with only one number on the stack, over doesn't copy it but pushes a 0 (5 over leaves 5 0). With an empty stack it does nothing. Its boolean stack counterpart, overbool, pushes a true when there is only one value.