Skip to main content

Sum

Returns the sum of two inputs.

Sum block

Description​

The Sum block returns the sum of two inputs. This is a code block part of the Math drawer.

Usage​

Returns the sum of two inputs.

Syntax​

Inputs in this block:

  • First input: a number
  • Second input: a number
  • Which will then be added together

Example​

In this model, whenever an Elephant eats a patch of Grass, its health (a trait of the breed Elephant) increases by 1. This is demonstrated visually by setting size equal to health.

Sum example code

Notes​

The Sum block is one of the fundamental arithmetic operations used throughout StarLogo Nova programs.