Archive.png This article or section documents something not included in the current version of Scratch (3.0). It is only useful from a historical perspective. For information on the feature that replaced this one, see () of () (Operators block).
abs ()
(abs ():: operators)
Category Numbers
Type Reporter
Removed in 20Oct07 (1.2 alpha)

The abs () block was a Numbers block (the former name of operators blocks) and a Reporter block. The block reports the absolute value of the input. It was merged with the () of () block in Scratch 20Oct07, which at the time only contained 11 mathematical functions.

The absolute value can be described as the distance of a number from 0. Another way to describe absolute value is that it makes a number positive — if it is negative, it becomes positive, and if it is positive, it stays positive. For example, the absolute value of -3 is +3 and the absolute value of +4 is +4.


Main article: List of Block Workarounds

This block can be replicated with the following code:

if <(num) < (0)> then
    set [abs v] to ((num) * (-1))
    set [abs v] to (num)

It can also be replicated with the block that replaced it.

([abs v] of ())

See Also

Cookies help us deliver our services. By using our services, you agree to our use of cookies.