ABS - QB64 Wiki


From QB64 Wiki

Jump to: navigation, search

The ABS function returns the the unsigned numerical value of a variable or literal value.


positive = ABS(numericalvalue)


  • ABS always returns positive numerical values. The value can be any numerical type.
  • Often used to keep a value positive when necessary in a program.
  • Use SGN to determine a values sign when necessary.
  • QB64 allows programs to return only positive _UNSIGNED variable values using a DIM or _DEFINE statement.

Example: Finding the absolute value of positive and negative numerical values.

a = -6 b = -7 c = 8 IF a < 0 THEN a = ABS(a) b = ABS(b) c = ABS(c) PRINT a, b, c

6 7 8

See also:

Go to Keyword Reference - Alphabetical
Go to Keyword Reference - By usage
Go to Main WIKI Page
  • Page
  • Discussion
  • View source
  • History
Personal tools
  • Log in
  • What links here
  • Related changes
  • Special pages
  • Printable version