Limbo supports slicing on arbitrary array types, including strings, as strings are arrays of bytes.
This section shows slicing from the beginning of an array to the index up to before the variable n
.
This section shows slicing from the index 4 to the end of the array.
This section shows several slicing operations. First c
is created as the slice of str
from index 2 through the index prior to the final index of str
. The printout is then a string version of the slice of c
from index 4 through the 7th index.
; limbo slices.b
; slices
little_baby_ducks
lit
le_baby_ducks
_bab
;
- What happens if you try to slice an empty string,
""
? - Can you slice in the format
[:n:]
?