>I’m trying to use a switch statement inside a conditional loop
inside a cfscript block. The break; statement for each switch case throws
me out of the loop altogether. If I use “continue;” instead of “break” it
just processes to the end of the switch statement. Any
clues? Is it possible to do this in cfscript?
Thanks
in advance,
Brad
---------------------------
Brad:
Here ya go
--->
<cfscript>
variables.expense1 =
'Printing';
variables.expense2 = 'Postage';
variables.expense3 = 'Mail
House';
variables.expense4 = 'Postage';
expense1_value =
1;
expense2_value = 1;
expense3_value = 1;
expense4_value =
1;
for (i=1; i LTE 4; i=incrementvalue(i)) {
switch(evaluate("expense#i#"))
{
case
"Printing":
{
variables.myval = 1 +
evaluate("variables.expense#i#_value");
break;
}
case
"Postage":
{
variables.myval = 2 +
evaluate("variables.expense#i#_value");
break;
}
case "Mail
House":
{
variables.myval = 3 +
evaluate("variables.expense#i#_value");
break;
}
}
}
</cfscript>
<cfoutput>
#variables.myval#
</cfoutput>
Warmest
Regards,
Phillip B. Holmes
