From Test-Scratch-Wiki

Mass editor (talk | contribs) (Automated edit: Updated Test Wiki copy of English Wiki page.) |
Mass editor (talk | contribs) (Automated edit: Updated testwiki copy of enwiki page) |
||

(2 intermediate revisions by 2 users not shown) | |||

Line 1: | Line 1: | ||

− | {{redirect|Add|the List block with "Add" in its name|Add () to () (block)}} | + | {{:Eng:() + () (block)/translate}}{{redirect|Add|the List block with "Add" in its name|Add () to () (block)}} |

{{Block | {{Block | ||

|name = () + () | |name = () + () | ||

Line 63: | Line 63: | ||

[[id:() + () (balok)]] | [[id:() + () (balok)]] | ||

[[ru:() + () (блок)]] | [[ru:() + () (блок)]] | ||

+ | [[ja:() + () (ブロック)]] |

## Latest revision as of 05:50, 11 March 2018

*"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

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

In Scratch 1.4 and previous versions, it sometimes converts very large numbers 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

() + ()
• () of ()More blocks... |