Skip to main content
New Participant
Nov 17, 2024 5:37 PM UTC
Question

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

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
    Nov 17, 2024 6:17 PM UTC

    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))
          )
        )
      )
    )

    New Participant
    Nov 18, 2024 3:55 AM UTC

    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