Using OOP, I want to be able to create multiple machines that would perform a certain action every few seconds, however, the time that these objects would perform these actions would be different between each machine.
For example, I want a computer with a timer of 5 seconds printing “I’m a potato” every 5 seconds, whilst another computer which will be also printing the same message, however would do so every 10 seconds.
I initially thought on creating an array with the all of the instances and looping through them, but I’m unsure on how to go from there. Is there is possibly a way to have these different objects continue running continuously on different threads within a single script easily?