Logo

Programming-Idioms

History of Idiom 165 > diff from v28 to v29

Edit summary for version 29 by noaoh:
New Java implementation by user [noaoh]

Version 28

2019-01-06, 08:00:51

Version 29

2019-02-09, 04:55:48

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
int items[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
int x = items[items.length - 1];
Origin
https://stackoverflow.com/questions/8755812/array-length-in-java
Demo URL
https://repl.it/@noaoh/EnviousDeliciousSign