Schmetter
Schmetter

Reputation: 5

How can I slice a list in Memgraph similar to Python list slicing?

I am familiar with Python and know that I can slice a list using a simple syntax like this:

my_list = [1, 2, 3, 4]
sliced_list = my_list[2:4]
print(sliced_list)   

As output I get [3, 4]

This way I can access a subset of elements from a list.

I need to perform similar operations in Memgraph. Is there a way to slice a list in Memgraph?

Upvotes: 0

Views: 19

Answers (1)

Moraltox
Moraltox

Reputation: 924

This should work:

RETURN [1,2,3,4][2..4]

Upvotes: 0

Related Questions