dimanche 3 février 2019

How can I avoid using global variable to increment a number

I have two instances containing a list (array). I'm trying to concatenate two lists from each instance with a number in a sequence. To make the numbers go in a sequence, what would be the best way to do this?

I think the easiest way to do is declaring a global variable such as "g_count = 0" then increment this from each instance.

But is there any better way to avoid using a global variable?

Aucun commentaire:

Enregistrer un commentaire