Skip to main content
November 17, 2024
Question

I need code for reversing a number with out using the appian functions

  • November 17, 2024
  • 2 replies
  • 0 views

a!localVariables(
local!num: 12345,
local!reversed: 0,

{
a!forEach(
items: local!num,
expression:
a!localVariables(
local!reversed{local!num: quotient(local!num, 10),
local!reversed: ((local!reversed * 10) + local!num),
local!num: mod(local!num,10)},
)
)
}
)

    2 replies

    stefanhelzle0001
    Brainy
    November 17, 2024

    Which of the Appian functions do you want to avoid?

    What is your shared code meant to do?

    An example which does not use the reverse() function:

    a!localVariables(
      local!value: 12345678,
      local!digits: tointeger(char(code(local!value))),
      tointeger(
        concat(
          index(
            local!digits,
            count(local!digits) - enumerate(count(local!digits))
          )
        )
      )
    )

    November 18, 2024

    Thankyou for your code!
    I just wanted to know is there any other way with out using count, enumerate functions to reverse a number by just using only looping functions in Appian