"Add" redirects here. For the List block with "Add" in its name, see Add () to ().
For the boolean logic gate, see () or ()
() + ()
(() + ())
Category Operators
Type Reporter
Introduced in 11Oct03 (0.x)

The () + () block is an Operators Block and a Reporter Block. The block adds two values and reports the result.

Example Uses

The block is mainly used for calculations where addition is needed.

Some common uses for the () + () block:

  • Calculator scripts
set [answer v] to ((a) + (b))
  • Math formulas
((((2) * (pi)) * ((r) * (r))) + (((2) * (pi)) * ((r) * (h))))
  • Adding lists of numbers
set [n v] to (0)
repeat (length of [numbers v])
    change [n v] by (1)
    set [sum v] to ((item (n) of [numbers v]) + (sum))
end

Workaround

Main article: List of Block Workarounds

The block can be replicated with any of the following code:

((a) - ((0) - (b)))
((a) - ((-1) * (b)))
set [output v] to (a)
change [output v] by (b)

See Also