Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Sort vector of numbers

  • sort
fn main() {
    let mut numbers = vec![10, 12, 11];
    println!("{:?}", numbers);
    numbers.sort();
    println!("{:?}", numbers);
}
[10, 12, 11]
[10, 11, 12]