The abs2(x)
method returns the square of the x
.
abs2(x)
x
: The value for which the square of the absolute value is to be found.
The square of absolute value for the specified value will be returned.
The code below demonstrates how to use the abs()
method.
## find abs2 of 10println( "abs2(10) => $(abs2(10))")## find abs2 of -3println( "abs2(-3) => $(abs2(-3))")## find abs2 of -3.6println( "abs2(-3.6) => $(abs2(-3.6))")
In the code above, we do the following:
abs2()
method with 10
as an argument. The abs2(10)
will return 100
.abs2()
method with -3
as an argument. The abs2(-3)
will return 9
.abs2()
method with -3.6
as an argument. The abs2(-3.6)
will return 12.96
.