| Frank Swarbrick 2006-03-08, 6:55 pm |
| Richard<riplin@Azonic.co.nz> 03/07/06 2:11 PM >>>
> am not even sure that anyone wants evaluate to be included in Java or
>any other language, it has its own idiom.
Without something similar to COBOL's EVALUATE you must, in Java, do
something like....
if (myString == "one") {
one();
}
else if (myString == "two") {
two();
}
else if (myString == "three") {
three();
}
else {
four();
}
Wouldn't it be nicer to say:
switch (myString) {
case "one":
one();
break;
case "two":
two();
break;
case "three":
three();
break;
default:
four();
break;
}
(Actually, eliminating those silly 'breaks' woul be even nicer, but...)
Of course the above assumes we're comparing the value of the object myString
and not the object itself. I'm now totally as to which does
what...
Frank
---
Frank Swarbrick
Senior Developer/Analyst - Mainframe Applications
FirstBank Data Corporation - Lakewood, CO USA
|