notice how the operator changes between and and or when the not is pushed into an expression one application of boolean algebra is the analysis and simplification of boolean expressions inside of programs for examplelet' go back to the racquetball game one more time abovewe developed loop condition for continuing the game that looked like thiswhile not (scorea = or scoreb = )continue playing you can read this condition as something likewhile it is not the case that player has or player has continue playing we're pretty sure that' correctbut negating complex conditions like this can be somewhat awkwardto say the least using little boolean algebrawe can transform this result applying demorgan' lawwe know that the expression is equivalent to this(not scorea = and (not scoreb = rememberwe have to change the or to and when "distributingthe not this condition is no better than the firstbut we can go one step farther by pushing the nots into the conditions themselves while scorea ! and scoreb ! continue playing now we have version that is much easier to understand this reads simply as while player has not reached and player has not reached continue playing this particular example illustrates generally useful approach to loop conditions sometimes it' easier to figure out when loop should stoprather than when the loop should continue in that casesimply write the loop termination condition and then put not in front of it an application or two of demorgan' laws can then get you to simpler but equivalent version suitable for use in while statement other common structures taken togetherthe decision structure (ifalong with pre-test loop (whileprovide complete set of control structures this means that every algorithm can be expressed using just these once you've mastered the while and the ifyou can write every conceivable algorithmin principle howeverfor certain kinds of problemsalternative structures can sometimes be convenient this section outlines some of those alternatives post-test loop suppose you are writing an input algorithm that is supposed to get non-negative number from the user if the user types an incorrect inputthe program asks for another value it continues to reprompt until the user enters valid value this process is called input validation well-engineered programs validate inputs whenever possible here is simple algorithm