(Redirected from Addition)

*"Add" redirects here. For the List block with "Add" in its name, see Add () to () (block).*

() + () | |

Category |
Operators |

Type |
Reporter |

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

The numbers can be typed directly into the block, or Reporter blocks can be used instead.

## Example Uses

In many projects, numbers must be added together—this block will do the job.

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

- Calculator scripts

set [answer v] to ((a) + (b))

- 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

- Math formulas

((((2) * (pi)) * ((r) * (r))) + (((2) * (pi)) * ((r) * (h))))

- Addition

when green flag clicked ask [what is the sum] and wait forever if <(answer) = [1+1]> then say ((1) + (1)) end

## Scientific Notation

This article or section documents something not included in the current version of Scratch (3.0). It is only useful from a historical perspective. |

Sometimes in Scratch 1.4 and previous versions, very large numbers are converted into scientific notation to save space. Scientific notation is simply the number in the form a*10^{b}. These can be converted to a normal number by performing any mathematical function on it, such as adding. So if a variable named "number" has a value of 3*10^{3} and one want to display it as a normal number, one can change it by:

((number) + (0))

It will then report "3000".

## Workaround

*Main article: List of Block Workarounds*

The block can be replicated with the following code:

((a) - ((0) - (b)))

((a) - ((-1) * (b)))

set [output v] to (a) change [output v] by (b) //output would be the answer, 'a' would be the first number, 'b' the second

## See Also

() + () • () - () • () * () • () / () • Pick Random () to () • () < () • () = () • () > () • () and () • () or () • Not () • Join ()() • Letter () of () • Length of () • () Mod () • Round () • () of ()More blocks... |