Is there anyway to make this code snippet more efficient?
I am working on some code where I have this snippet
user = "C";
indice = "3";
switch (user) { case "A": A[indice - 1] = "X"; break; case "B": B[indice -
1] = "X"; break; case "C": C[indice - 1] = "X"; break; } user = "B";
indice = 21;
switch (user) {
case "A":
A[indice - 1] = "X";
break;
case "B":
B[indice - 1] = "X";
break;
case "C":
C[indice - 1] = "X";
break;
}
I was wondering if there is a possible way to make this code more
efficiently so I don't have to rewrite it X ammount of times there could
also be more values then the ammount of switch's I have setup, any help
would be much advice would be a great help
No comments:
Post a Comment