Say I have three conditions, represented by Boolean variables. How do I make the following blocks of code simpler?
bool condition1, condition2, condition3; //assuming they already have values
if (condition1 && condition2)
{
if (condition3)
{
//Few lines of code here
}
}
else
{
//Same few lines of code above here
}
Is there a better/neater way of simplifying this, aside from putting the 'lines of code' in a method? Can the inner if be removed? Thanks.
Aucun commentaire:
Enregistrer un commentaire