lastindex returns the final valid index of an indexed collection or string. It is especially useful when walking strings, where character positions may skip because UTF-8 characters use different numbers of code units. section 11.1.1
Walk an indexed value safely
For an array, indices increase normally: i = firstindex(xs); while i <= lastindex(xs); println((i, xs[i])); i = nextind(xs, i); end. The same pattern works for strings, but nextind advances over complete characters rather than blindly incrementing. For ordinary iteration, prefer for loops; use eachindex when you need character indices. section 11.1.1
