how to name a timer with a variable

314 views Asked by At

I'm trying to work out how I can call a timer with a variable. I'd like to code it more efficiently than write the same code multiple times when I could just call the one timer but with a variable name. All these timers will run the same process, run for x many mins depending on the number of minutes between start and end. For example:

I'd like to run a set of commands using timer(i) where (i) is passed as a selection from a list rather than: if (i) = 1 Timer1.active := True: if (i) = 2 Timer2.active := True; etc.etc. The thing is the number of items on the list can vary as it is set elsewhere in the code.

Sorry if this seems like a dumb question but when I was teaching I always told my classes there is no such thing as a dumb question. Thanks in advance.

0

There are 0 answers