mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-09-16 16:44:05 +00:00
6e01fc8dce
Added new _STRCMP and _STRICMP commands for quick string comparisons. Cleaned up QB64 to finish removing the QUI (quick user insert) code and folders. Altered UCASE and LCASE routines to be faster in some situations for us.
36 lines
No EOL
996 B
Text
36 lines
No EOL
996 B
Text
The {{KW|ABS}} function returns the the unsigned numerical value of a variable or literal value.
|
|
|
|
|
|
{{PageSyntax}}
|
|
:{{Parameter|positive}} = '''ABS({{Parameter|numericalvalue}})'''
|
|
|
|
|
|
{{PageDescription}}
|
|
* 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 {{KW|_DEFINE}} statement.
|
|
|
|
|
|
''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]]
|
|
* [[_UNSIGNED]] {{text|(integer types only)}}
|
|
* [[_DEFINE]]
|
|
* [[Mathematical Operations]]
|
|
|
|
|
|
{{PageNavigation}} |