I will try and explain wha I have done. The main part is to take the original code:
and replace it with a loop:
So how does it work? Well: in the original repeating sections there are three items that change. I have marked them in red below:
These I have picked out and placed in the nested array:
First block:
Second block:
and so on.
These blocks are then bundled into another array:
Then the remaining code uses this data:
basically steps through each block of data setting the variable var to contain the data.
var now contains an array of three items. The three items are identified as: var(0), var(1), and var(2). Which for the first block will contain :
So you can see, I hope, that as the variables contain the values from the block the code will look like the original:
I hope this helps
Bookmarks