Variable declaration reset: Difference between revisions

m
Line 301:
 
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.
<lang jq>[1,2,2,3,4,4,5]
```
[1,2,2,3,4,4,5]
| . as $array
| range(1;length)
| select( $array[.] == $array[.-1])
</lang>
```
 
 
=={{header|Julia}}==
2,442

edits