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

Idiom #165 Last element of list

Assign to variable x the last element of list items.

x := items[len(items)-1]
var x = items[items.length - 1];
x := items[high(items)];
x = items[-1]
x = items.last
x = items[-1]
val x = items.takeRight(1)

Do you know the best way to do this in your language ?
New implementation...

Idiom created by

programming-idioms.org