.type() The .type() function returns the type of a variable. Example 5 Using .type() in a #if directive #if($a.type()=='int') #set($b=$a.toDouble()/2) #elseif($a.type()=='double') #set($b=$a/2) #end
#if($a.type()=='int')
#set($b=$a.toDouble()/2)
#elseif($a.type()=='double')
#set($b=$a/2)
#end