let mut comic_collection = vec::new(); comic_collection.push("guardians of the galaxy"); let mut policy_review = || { println!("reviewing preexportation policy..."); }; fn reset_collection(c: &mut vec<string>) { c.clear(); println!("collection reset successfully!"); } fn add_comic(c: &mut vec<string>, title: &str) { c.push(string::from(title)); println!("comic added: {}", title); } loop { if comic_collection.len() < 5 { add_comic(&mut comic_collection, "the guarded secrets"); } else { break; } } policy_review(); reset_collection(&mut comic_collection); fn deflect_unwanted(c: &vec<string>) { for comic in c { if comic.contains("unwanted") { println!("detected and deflected!"); break; } else { println!("safe collection: {}", comic); } } } deflect_unwanted(&comic_collection);