I have an array of numbers, while looping through array I want to output two elements at the time. Here is my array:
<cfset myArray = [74539,1500285,1334095,1500293,1334096,1500294,1334098,1500295,1334109,1500296]>
Here is my loop:
<cfoutput>
<cfloop from="1" to="#arraylen(myArray)#" index="a">
<cfset currAssignID = firstAssignList[a]>
<cfset nextAssignID = firstAssignList[a+1]>
#currAssignID# - #nextAssignID#<br>
</cfloop>
</cfoutput>
Code above will produce this output:
74539 - 1500285
1500285 - 1334095
1334095 - 1500293
1500293 - 1334096
1334096 - 1500294
1500294 - 1334098
As you can see my code is outputting previous number every time, I would like to see this:
74539 - 1500285
1334095 - 1500293
1334096 - 1500294
1334098 - 1500295
1334109 - 1500296
If anyone knows where my code is breaking please let me know. Thank you.