Logo

Programming-Idioms

History of Idiom 165 > diff from v62 to v63

Edit summary for version 63 by OC:
New Obj-C implementation by user [OC]

Version 62

2020-05-18, 03:57:03

Version 63

2020-10-10, 20:24:17

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.

Variables
x,items
Variables
x,items
Imports
@import Foundation;
Code
x=items.lastObject;
Comments bubble
Unlike indexing, works for an empty list properly (returning nil)