lundi 1 novembre 2021

A followup if statment

My question is a bit hard to describe so I have written a hypothecical code (nonfuctioning) down below and I wonder if there is a similar alternative in C#:

if(Red == true)
{ 
i -= 3;
}
else if(Yellow == true)
{ 
i -= 2
}
then
{
 list.Clear();
}
else{}

A "then" function of sorts that both if statements follow if one where to execute. The use of this would simply be so that I do not need to do in this case a list.Clear(); in every if statment.

Aucun commentaire:

Enregistrer un commentaire