How to find the power of a number (x to the power of y) without using any Appian function like power() ?

Discussion posts and replies are publicly visible

First question: since there is a power() function why do you want a different method?

I do not understand why you need to create a custom function however, here is the code below which will help you in achieving the required result.

you can substitute product function with an sub rule to calculate that was well.

a!localVariables( local!number: 2, local!power: 5, local!array: repeat( local!power, local!number ), reduce( fn!product, 1, local!array ) )

on top of what is already replied. you can use caret operator (^) as well . Example :- 2^3 returns 8. I guess its a interview question as power() is good enough for all scenarios.

it is work

a!localVariables( local!power:3, local!base:4,local!result:repeat(local!power,local!base),product(local!result))