Forum Discussion

BowBharath's avatar
7 years ago

Match function is available here !

Math.pow(1000, i+1);   <#assign decimal = Math.pow(1000, val+1)>   What is the correct function here ?
  • TariqHussain's avatar
    7 years ago

    BowBharath - No such function is available in freemarker. You can check all the available function for number here http://freemarker.org/docs/ref_builtins_number.html

     

    Below is a custom function which would return the same result. 

    <#function Mathpow base exponent>
       <#assign result = 1 />
       <#list 1..exponent as val>
        <#assign result = result*base />
      </#list>
      <#return result />
    </#function>
    
    ${Mathpow(4,3)}  //64