#initilize working variables. working_variable0= working_variable1=.... = working_variable0=0; for (a_store_id in array2){ working_variable0++; if (array1[a_store_id].card1) working_variable1++; if (array1[a_store_id].card2) working_variable2++; if (array1[a_store_id].card3) working_variable3++; ... if (array1[store_id].cardN) working_variableN++; } if (workong_varialbe0 == working_varialbe1) show_up(card1); if (workong_varialbe0 == working_varialbe2) show_up(card2); ... if (workong_varialbe0 == working_varialbeN) show_up(cardN);