Functions - lang.int

abs

Return absolute value of n.

fromHexString

Returns the integer that s represents in hexadecimal. Both uppercase A-F and lowercase a-f are allowed. It may start with an optional + or - sign. No 0x or 0X prefix is allowed. Returns an error if the s is not in an allowed format.

fromString

Return the integer that s represents in decimal. Returns error if s is not the decimal representation of an integer. The first character may be + or -. This is the inverse of value:toString applied to an int.

max

Maximum of all the arguments.

min

Minimum of all the arguments.

sum

Sum of all the arguments. 0 if no args

toHexString

Returns representation of n as hexdecimal string. There is no 0x prefix. Lowercase letters a-f are used. Negative numbers will have a - prefix. No sign for non-negative numbers.

abs

(int n)

returns int

Return absolute value of n.

Parameters

  • n int
  • int value

  • Return Type

    (int)
  • absolute value of n

fromHexString

(string s)

returns int | error

Returns the integer that s represents in hexadecimal. Both uppercase A-F and lowercase a-f are allowed. It may start with an optional + or - sign. No 0x or 0X prefix is allowed. Returns an error if the s is not in an allowed format.

Parameters

  • s string
  • hexadecimal string representation of int value

  • Return Type

    (int | error)
  • int value or error

fromString

(string s)

returns int | error

Return the integer that s represents in decimal. Returns error if s is not the decimal representation of an integer. The first character may be + or -. This is the inverse of value:toString applied to an int.

Parameters

  • s string
  • string representation of a integer value

  • Return Type

    (int | error)
  • int representation of the argument or error

max

(int n, int[] ns)

returns int

Maximum of all the arguments.

Parameters

  • n int
  • first argument to check for max value

  • ns int[]
  • rest of the argument to check for max value

  • Return Type

    (int)
  • maximum value of all provided values

min

(int n, int[] ns)

returns int

Minimum of all the arguments.

Parameters

  • n int
  • first argument to check for min value

  • ns int[]
  • rest of the argument to check for min value

  • Return Type

    (int)
  • min value of all provided values

sum

(int[] ns)

returns int

Sum of all the arguments. 0 if no args

Parameters

  • ns int[]
  • int values to sum

  • Return Type

    (int)
  • sum of arguments

toHexString

(int n)

returns string

Returns representation of n as hexdecimal string. There is no 0x prefix. Lowercase letters a-f are used. Negative numbers will have a - prefix. No sign for non-negative numbers.

Parameters

  • Return Type

    (string)
  • hexadecimal string representation of int value