Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Go

Idiom #357 Swap elements of list

Swap the elements at indices i, j in the list items

items[i], items[j] = items[j], items[i]
items.swap(i, j)

New implementation...
< >
programming-idioms.org