foreach a_item in a_array foreach b_item in b_array if a_item equals b_item put a_item in c_array end if end for end for