Skip to content

Instantly share code, notes, and snippets.

@atuttle
Created December 2, 2012 03:39
Show Gist options
  • Save atuttle/4186852 to your computer and use it in GitHub Desktop.
Save atuttle/4186852 to your computer and use it in GitHub Desktop.
<cfscript>
_ = new underscore();
fail = _.range(10);
writeDump(var=fail, label="_.range(10)");
customRange = [];
start = 0;
step = 1;
i = 1;
while (i <= 10){
customRange[i] = start;
start += step;
i++;
}
writeDump(var=customRange, label="custom while loop with i++ moved OUT of assignment");
customRange = [];
start = 0;
step = 1;
for (i = 1; i <= 10; i++){
customRange[i] = start;
start += step;
}
writeDump(var=customRange, label="for loop");
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment