Logo

Programming-Idioms

History of Idiom 165 > diff from v3 to v4

Edit summary for version 4 by steenslag:
[Ruby] added comment

Version 3

2017-10-23, 10:51:07

Version 4

2017-10-23, 10:52:04

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
x = items.last
Code
x = items.last
Comments bubble
x = items[-1] is another way.