请考虑以下文档:
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=CFScript_11.html#1161053
我正在研究以下代码的描述:
<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";
描述说,“创建两个一维数组,一个包含已接受的申请人,另一个包含被拒绝的申请人。”
我是ColdFusion的新手,我没有在上面的代码中看到使用array关键字的任何数组声明,就像下面的文档一样:
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=arrayStruct_03.html#1121128
请解释一下。
答案 0 :(得分:3)
您需要初始化acceptedApplicants
和rejectedApplicants
数组
应该有
acceptedApplicants = [];
rejectedApplicants= [];
代码中的某处。就像彼得所说,如果这是一个函数,请确保你改变那些变量。