How to check if array is sorted in Rust

1 Answer

0 votes
#![feature(is_sorted)]

fn main() {
    let arr = [4, 5, 8, 0, 1];

    println!("{}", arr.is_sorted());
}



/*
run:

false

*/

 



answered Dec 9, 2022 by avibootz
...