Array in function

fn main(){
   let x = [1, 2, 3, 4,  5];
   let result = count_items(&x);
   println!("{}", result);
}

fn count_items(item: &[i32]) -> usize{
    item.len();
}

its not working

fn count_items(item: &[i32]) -> usize{
    item.len() // no `;` at the end
}

By the way, just continue on the previous thread where you ask the original question.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.