What is it and what is it used for?

# How do you use absolute value in coding?

**PopTart0219**#2

Absolute value is represent by the |#| (I don't know if it's different inn the app).

It's basically making the number positive if it isn't already.

**LazyLizard**#3

An absolute value is the opposite of the number.

For example, the absolute value of 3 is -3, anf the absolute value of 21 would be -21.

MATH LESSON- 9+10=21

It is an operator that changes any number to a positive number.

Example: 234 will stay 234, but -765 will change to 765.

hope I was right

Oh! I remember something like this in my math book! Thanks, @PopTart0219 @CreationsOfaNoob @LazyLizard what could I use it for in coding?

**PopTart0219**#6

Eeerrrrmmmâ€¦

Maybe if you have a negative number that changes, and you need to make it positive again.

**Gilbert189**#7

Technically incorrect; the real definition is the distance the number is from zero. :D

What Gilbert said XD

I understood the concept but I *fail* at explaining and *doing* math. :3

**LazyLizard**#10

I'm not sure. I haven't been able to code for months, so I can't really help you with that, I'm so sorry!

**RodeoHero**#11

Just to clarify: Absolute value is not the opposite of a number. It's the distance from 0 like rainbow chicken said.

Abs 21 = 21

Abs -21 = 21

**TheGreenBanana**#12

Yah I get it now, I just forgot the term. My question is, how can I use them in coding?

**BuildASnowman**#13

A lot of things, but definitely the most important is distance. If you want to find the distance between 2 object's x positions, it's Abs(x1-x2).

**LazyLizard**#15

Woops!

Ignore that! XD

Maybe I should have used the wifi when typing. I almost always get wrapped up in not getting yelled at for using the data and just let my fingers fly!