1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-01 15:00:38 +00:00
QB64-PE/internal/help/ABS.txt

39 lines
979 B
Plaintext
Raw Normal View History

The [[ABS]] function returns the unsigned numerical value of a variable or literal value.
{{PageSyntax}}
2017-10-10 14:55:21 +00:00
:{{Parameter|positive}} = [[ABS]]({{Parameter|numericalValue}})
{{PageDescription}}
2017-10-10 14:55:21 +00:00
* [[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.
2017-10-10 14:55:21 +00:00
* Use [[SGN]] to determine a value's sign when necessary.
* '''QB64''' allows programs to return only positive [[_UNSIGNED]] variable values using a [[DIM]] or [[_DEFINE]] statement.
2017-10-10 14:55:21 +00:00
{{PageExamples}}
''Example:'' Finding the absolute value of positive and negative numerical values.
{{CodeStart}} '' ''
a = -6
b = -7
c = 8
{{Cl|IF...THEN|IF}} a < 0 {{Cl|THEN}} a = {{Cl|ABS}}(a)
b = {{Cl|ABS}}(b)
c = {{Cl|ABS}}(c)
{{Cl|PRINT}} a, b, c '' ''
{{CodeEnd}}
{{OutputStart}} 6 7 8
{{OutputEnd}}
{{PageSeeAlso}}
* [[SGN]], [[DIM]]
2017-10-10 14:55:21 +00:00
* [[_UNSIGNED]]
* [[_DEFINE]]
* [[Mathematical Operations]]
2019-04-15 01:15:33 +00:00
{{PageNavigation}}
<