Quantcast
Channel: ColdFusion – ColdFusion
Viewing all articles
Browse latest Browse all 100

Quick thoughts on structs

$
0
0

Here is a quick guide to all the different kinds of structs in ColdFusion

<cfscript>

// plain old struct
a = {};

a.b = “Bunny”;
a.c = “Canary”;
a.d = “Doggy”;
a.append({“a” : “Apple”});
a.append({“f” : “Frog”});

writedump(a);

// ordered
a = [:];

a.b = “Bunny”;
a.c = “Canary”;
a.d = “Doggy”;
a.append({“a” : “Apple”});
a.append({“f” : “Frog”});

writedump(a);

// sorted
a = StructNew(“ordered”, “text”);

a.b = “Bunny”;
a.c = “Canary”;
a.d = “Doggy”;
a.append({“a” : “Apple”});
a.append({“f” : “Frog”});

writedump(a);
</cfscript>

Which results in

See:

https://cffiddle.org/app/file?filepath=8bcbbb23-90ec-44a4-9893-b835ac7fbb97/3550b62f-5bbc-4efd-ad7b-4975d25155dc/c344182b-f312-4092-8621-e14d697887a2.cfm

The post Quick thoughts on structs appeared first on ColdFusion.


Viewing all articles
Browse latest Browse all 100

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>