type() The type() function returns the type of an object. Example 33 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