Variable declaration reset: Difference between revisions

Line 300:
is specified to begin at the second element.
 
As it happens, if the first argument of range/2 was changed to 0, then in this particular case the correct results would still be correct because at the first iteration, the test would be $array[0] == $array[-1], the point being that $array[-1] evaluates to the last element of the array. That is, the "bug" in the program would not be revealed by the test case.
<lang jq>[1,2,2,3,4,4,5]
| . as $array
2,442

edits