I have a basic if-else if block of code. Here is the simplified version
if (var == 1) {
finalString = "string1";
} else if (var == 3) {
finalString = "string3";
} else if (var == 4) {
finalString = "string4";
} else {
finalString = "no string found";
}
I am trying to use enums approach, so I created an enum class
public enum MyValues {
string1(1),
string2(3),
string4(4);
...
...
}
Is there a way to improve my if/else statements with the enum I created?