Question

Please consider the following documentation:

http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=CFScript_11.html#1161053

I'm studying the description of following code:

<cfscript>

    //Set the variables

    acceptedApplicants[1] = "Cora Cardozo";
    acceptedApplicants[2] = "Betty Bethone";
    acceptedApplicants[3] = "Albert Albertson";
    rejectedApplicants[1] = "Erma Erp";
    rejectedApplicants[2] = "David Dalhousie";
    rejectedApplicants[3] = "Franny Farkle";
    applicants.accepted=acceptedApplicants;
    applicants.rejected=rejectedApplicants;

    rejectCode=StructNew();
    rejectCode["David Dalhousie"] = "score";
    rejectCode["Franny Farkle"] = "too late";

The description says that, "Creates two one-dimensional arrays, one with the accepted applicants and another with the rejected applicants. "

I'm new to ColdFusion and I don't see any array declaration using the array keyword in the above code just like the following doc:

http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=arrayStruct_03.html#1121128

Please explain.

Was it helpful?

Solution

You need to initialize your acceptedApplicants and rejectedApplicants arrays

There should be

acceptedApplicants = [];
rejectedApplicants= [];

somewhere above in the code. Like Peter said, if this is in a function make sure you var those variables.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top