In this code I'm working on
I have two identical cashless payment devices with the only difference between them in the code being the number in their name/tag.Code:function(int n) {
block[3].whole = cashless1.displayData[1];
block[4].whole = cashless1.displayData[2];
block[5].whole = cashless1.displayData[3];
block[6].whole = cashless1.displayData[4];
block[7].whole = cashless1.displayData[5]; block[9].whole = cashless1.displayData[7];
block[8].whole = cashless1.displayData[6]; }
block[2].whole = cashless1.displayData[0];
I have functions that are set up to interact with one cashless payment device at a time, and I'm trying to add the functionality of being able to switch betwween which device the functions interact with, by giving it a number when you call the function.
Is there a way to edit all the references/tags for the 'cashless1' device, and have something like 'cashless#' where the pound sign is a variable/number that inserts the value given to 'n' when you call the function? Basically is there a way you can insert 'n' into the cashless device variables so I don't have to make a new copy of each function for each device that exists?