dimanche 8 décembre 2019

C# variable[#] in if statement where the # will be given later

I don't really know how to ask this question, my brain stopped.

I have some variables named tank1, tank2, tank3....

I want to use only one "if" statement with using the "tank" part of the variable and then adding its number after other actions.

if (tank + 1.ToString() > 5) like it's if (tank1 > 5)

Thanks.

Aucun commentaire:

Enregistrer un commentaire