Shorthand for all bools YES or all bools NO?
问题 Often in my code I need to check whether the state of x amount of bools are all true OR all bools are false. So I do: BOOL first, second, third; if((first && second && third) || (!first && !second && !third)) //do something Being a lazy programmer, I want to know if there is some mathematical shorthand for this kind of query, instead of having to type out this whole thing every time? 回答1: The shorthand for all bools the same is testing for (pairwise) equality: (first==second && second==third)