The reason for why I tried to used switch to replaced if statement because if statement is too long,but how can I replace double If statement by switch?
The algorithm is just like that :
if(a very long statetment are similar,except the string at the middle)
func1(parameter are same as func2);
if(a very long statement are similar,except the string at the middle)
func2(parameter are same as func2);
I just to do these but failure :
List initialization...
for(int i = 0 ; i < list.size();i++){
if(statement with list[i] == true){
switch(list[i])
{
case 1 :
test1();
case 2 : enter code here
test2();
case 3 :
test3();
}
}
}
And I am used Java,May anyone give me some suggestions.Thanks a lot.
Aucun commentaire:
Enregistrer un commentaire