Logo

Programming-Idioms

History of Idiom 165 > diff from v22 to v23

Edit summary for version 23 by Rustem B.:
[Rust] forgot ';'

Version 22

2018-04-18, 11:20:15

Version 23

2018-04-18, 13:11:11

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
let x = items[items.len()-1]
Code
let x = items[items.len()-1];
Demo URL
https://play.rust-lang.org/?gist=19581826c8e46df13343871138b3a417&version=stable
Demo URL
https://play.rust-lang.org/?gist=19581826c8e46df13343871138b3a417&version=stable