How to check whether a variable is a structure in ColdFusion

IsStruct() - check whether a variable is a structure

IsStruct.cfm


<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>IsStruct function example: how to check whether a variable is a structure</title>
</head>

<body>
<h2 style="color:HotPink">IsStruct Function Example</h2>
<cfset Color="Red">
<cfoutput>
<b>
Color: #Color#
<br />
Color is a Structure?: #IsStruct(Color)#
<br /><br />
</b>
</cfoutput>

<cfset Color=StructNew()>
<cfset Color.ID=1>
<cfset Color.Name="IndianRed">
<cfset Color.Value="##CD5C5C">

<cfdump var="#Color#" label="Color">

<br />
<cfoutput>
<b>
Now Color is a Structure?: #IsStruct(Color)#
</b>
</cfoutput>
</body>
</html>






More ColdFusion examples