std-method
LinkedList::pop_back
Remove the last item and return it by value. For an empty list the result is None. Expected stdout (not executed): Some(3) Some(2) Common mistake: Confusing pop_back with removal from the front.
Formal Syntax & Structure
rust syntaxrust
fn pop_back(&mut self) -> Option<T>Working Example
Example Snippetrust
fn main() { use std::collections::LinkedList; let mut edits = LinkedList::from([1, 2, 3]); println!("{:?}", edits.pop_back()); println!("{:?}", edits.back());}