mardi 26 avril 2016

coldfusion continue keyword within IF block in cfscript / Odd behaviour

Has anyone noticed this odd behaviour with the Continue word. It seems to kill all following code in the template when used within an If statement.

I tested this in CF and Lucee with http://cflive.net/

eg:

<cfscript>

writeoutput('test1, loop<br>');

for (x=0;x>5;x++){
    writeoutput(' gonna continue?');
    continue;
    writeoutput('continued within');
}

writeoutput('Out of loop..<br><br>');

writeoutput('test2, if<br>');

oURL    = true;
if(oURL) {
    writeoutput(' gonna continue?');
    continue; // seems to kill all following code
    writeoutput('continued within');
}

writeoutput(' out of If..');

writeoutput(' end');


for (x=0;x>5;x++){
  writeoutput('loop:' & x);
}


</cfscript>

Aucun commentaire:

Enregistrer un commentaire