Abs() (PlayBasic)
( PlayBasic 1.61 )
Abs - make a negative number positive (return absolute value)
Syntax
num = Abs ( x )
- num - returned positive number.
- x - number to change to positive
Description
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.
Example
In the example code below, both numbers are printed as positive 42.
Print Abs(42)
Print Abs(-42)
Sync
WaitKey
Related Pages
page revision: 2, last edited: 15 Jul 2012 02:52