I don’t quite understand the purpose of the abs() function. The name of the number is how far it is from zero so by knowing the identity of a number, you know how far it is from zero. Even if the identity of a number is stored as a variable, for example x, one could simply print x to identify the variable.

Is there a higher purpose for this function that I’m missing?

# Does the abs() function have a purpose?

**alexrodri01**#1

**stetim94**#2

Well, if you have an unknown number (negative or positive) and you want to know how far the number is from zero, abs is very useful. Otherwise you first have to determine if number is negative or positive, now we have a function doing this for us

abs(-42) is 42, that is important to understand

**system**#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.