Thomas wrote:
The following code throws a Undefined variable a1: error:
let a1 = 1 | let b = [1,2,3] | echo b[a1:-1]
When one puts a blank after a1, it's ok though:
let a1 = 1 | let b = [1,2,3] | echo b[a1 : -1]
Since a1 is no valid scope and a1: is an illegal variable
Using : both for scopes and Sublist is not ideal. But it's hard to
think of something that is better.
Ruby uses .. for this (eg a[2..-1]), which has a mathematical touch.
Putting spaces before and after the colon is perfectly ok for me though
-- now that I know it.