Shift index list within list range

I have a rather basic question about shifting list items.
I have a list of curves Main list = [0,1,2,3,4,5,6,7,8 ]. I have taken items indices of certain items. Selected list = [2, 4, 7, 8]. Now I want to get a list of index that are next to the Selected list. Next list = [3, 5, 8, 0], so that the last item becomes the first item. i thought just a shift list would do, but it is exceeding the list range. Is it possible ? What I am getting is [3, 5, 8, 9 ] or [8, 2, 4, 7]. both are wrong

List.ShiftIndex(yourOriginalList, -1) followed by List.GetItemAtIndex should do the trick.

Thanks, it worked :slight_smile:

1 Like