I have an if else statements that has 2 values that need to be evaluated whether they're null or not, then based on that, it chooses the right statement. The code below:
int? x;
int? y;
if(x == null and y == null) { do this part; }
else if (x != null and y == null) {do this second part; }
else if (x == null and y != null) {do this third part; }
else { do this last part; }
I am trying to find if there is a more efficient way to implement this. There is the option of a case statement, but I still want to know if there is a better way.
Aucun commentaire:
Enregistrer un commentaire