diff --git a/doc/operators/range b/doc/operators/range new file mode 100644 index 0000000000000000000000000000000000000000..97e6922cfbbfa9e7c0e255018c0925b38ac78f5f --- /dev/null +++ b/doc/operators/range @@ -0,0 +1,30 @@ +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..3] returns "foo" + "foobar"[4..6] returns "bar" + ({1,2,3})[..2] returns ({1,2}) + ({1,2,3})[2..] returns ({2,3}) + ({1,2,3})[..] returns ({1,2,3}) + +KEYWORDS + operators + +SEE ALSO + index