Logo

Programming-Idioms

History of Idiom 165 > diff from v9 to v10

Edit summary for version 10 by Florent:
[Scala] To fit to the wording

Version 9

2017-11-14, 15:05:39

Version 10

2017-11-14, 15:08:21

Idiom #165 Last element of list

Assign to variable x the last element of list items.

Idiom #165 Last element of list

Assign to variable x the last element of list items.

Code
// Assuming list is a valid list
list.takeRight(1)
Code
val x = items.takeRight(1)