XtScript Function: abs
Convert and return numbers into their absolute value
abs (absolute) is an XtScript function to convert and return numbers into their absolute value. This function is helpful when you working on a code where negative numbers are not allowed.
XtScript abs function basic syntax:
<!--parser:xtscript--> call abs $num=... <!--/parser:xtscript-->
Learn XtScript abs functions from example
Convert and return the negative numbers given
- Code:<!--parser:xtscript--> call abs $num=-875 print <br/><br/> var $age = -55 var $absolute_age = call abs $num=$age print Absolute age is $absolute_age <!--/parser:xtscript-->- Result:
875
Absolute age is 55
Absolute age is 55
Last edited on