NAME

range - cut a slice of an array or string

SYNTAX

a [ b .. c ]
or
a [ .. c ]
or
a [ b .. ]

DESCRIPTION

This operator cuts out a piece of an array or string. If a is an array a[b..c] will return an array containing a[b], a[b+1], a[b+2] to a[c]. Given a string about the same thing will happen, except the the result will be a string of course. If b is omitted, everything from the beginning up to and including c will be included. If c is omitted the result will include everything from (and including) b to the end.

EXAMPLES

"foobar"[0..2]
returns "foo"
"foobar"[3..5]
returns "bar"
({1,2,3})[..1]
returns ({1,2})
({1,2,3})[1..]
returns ({2,3})
({1,2,3})[..]
returns ({1,2,3})

KEYWORDS

operators

SEE ALSO

index