Logo

Programming-Idioms

History of Idiom 165 > diff from v17 to v18

Edit summary for version 18 by programming-idioms.org:
[D] List name items

Version 17

2018-02-04, 17:20:05

Version 18

2018-02-09, 00:23:44

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;
Imports
import std.range;
Code
int[] list;
auto x = list.back();
Code
int[] items;
auto x = items.back();
Comments bubble
using the range semantic.
Comments bubble
using the range semantic.