# Lastindex not defined for CartesianIndex

**URL:** https://discourse.julialang.org/t/lastindex-not-defined-for-cartesianindex/23028
**Category:** General Usage
**Created:** [April 11, 2019, 10:40am UTC](https://discourse.julialang.org/t/lastindex-not-defined-for-cartesianindex/23028 "2019-04-11T10:40:58Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![colintbowers](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/colintbowers/32/8033_2.png) [@colintbowers](https://discourse.julialang.org/u/colintbowers)
#### Post date: [April 11, 2019, 10:40am UTC](https://discourse.julialang.org/t/lastindex-not-defined-for-cartesianindex/23028/1 "2019-04-11T10:40:58Z")

</div>

Hi all,

I get a method error on the following on v1.1:

```julia
julia> i = CartesianIndex{2}(2, 3)
CartesianIndex(2, 3)

julia> lastindex(i)
ERROR: MethodError: no method matching lastindex(::CartesianIndex{2})

```

I know that you’re not supposed to be able to iterate over a `CartesianIndex` directly, but does the same logic apply to `lastindex`, or should I file this as an issue?

Cheers,

Colin
