get() on a List
In Gremlin how does one do a
get()
on a List
in order to access an item by index?Solution:Jump to solution
Gremlin doesn't have
get()
but you can accomplish similar things with the range()
, limit()
, tail()
, and skip()
:
```
gremlin> g.inject([10,20,30,40,50]).limit(local,1)
==>10
gremlin> g.inject([10,20,30,40,50]).tail(local,1)...1 Reply
Solution
Gremlin doesn't have
get()
but you can accomplish similar things with the range()
, limit()
, tail()
, and skip()
: