( PlayBasic 1.61 )
Abs - make a negative number positive (return absolute value)
num = Abs ( x )
- num - returned positive number.
- x - number to change to positive
Abs() changes a negative number to a positive number. If the number is already positive, it simply returns the number as is. It does this by returning the number's absolute value, or distance from zero.
In the example code below, both numbers are printed as positive 42.
Print Abs(42) Print Abs(-42) Sync WaitKey