Variable declaration reset: Difference between revisions
Content added Content deleted
m (→{{header|jq}}) |
|||
Line 300: | Line 300: | ||
is specified to begin at the second element. |
is specified to begin at the second element. |
||
As it happens, if the first argument of range/2 was changed to 0, 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. |
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] |
<lang jq>[1,2,2,3,4,4,5] |
||
| . as $array |
| . as $array |