How to get numbers between 2 numbers?

To get the all numbers between 2 numbers.

  Discussion posts and replies are publicly visible

  • a!localVariables(
      local!numberOne: 17,
      local!numberTwo: 5,
      if(
        local!numberOne = local!numberTwo,
        {},
        a!localVariables(
          local!lowerNumber: min(
            local!numberOne,
            local!numberTwo
          ),
          local!upperNumber: max(
            local!numberOne,
            local!numberTwo
          ),
          local!difference: local!upperNumber - local!lowerNumber - 1,
          1 + local!lowerNumber + enumerate(local!difference)
        )
      )
    )

  • If by "between" you mean "including the lower and upper values" then this would work for you:

    if(
      ri!lower > ri!upper,
      fn!tointeger({}),
      fn!enumerate(ri!upper - ri!lower + 1) + ri!lower
    )

    ...where ri!upper and ri!lower are integer values.

    If you want to exclude the lower/upper values then that would be a small tweak to the above code.