Logo

Programming-Idioms

History of Idiom 165 > diff from v16 to v17

Edit summary for version 17 by abertk:
New D implementation by user [abertk]

Version 16

2018-02-04, 17:16:56

Version 17

2018-02-04, 17:20:05

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.

Imports
import std.range;
Code
int[] list;
auto x = list.back();
Comments bubble
using the range semantic.