For example, let's say Dellin Betances is facing Mike Napoli. To date, Napoli is 0-7 off Betances with four Ks and three walks. Whatever Betances is doing so far, is working, but those three walks also show that he's being careful and hoping Napoli chases bad pitches, namely his curve/slider/knuckle-curve/Bugs Bunny pitch low-and-away.
In short, a while loops says, "While X is true, do Y." In Betances' case against Napoli that translates to, "While I continue to strike him out, continue to throw him nasty Bugs Bunny slurves low-and-away."
Here's a more specific example. Let's say that while Betances continues to give up less than two dingers to Napoli (to this date, no one has hit more than one off of Betances), Betances should continue to pitch him the same way.

Let's talk through this one. We have a variable for the number of homers Napoli has hit off of Betances (napoliHRsVsBetances) which is currently set to zero.
Then we have our while loop. While the number of Napoli homers versus Betances is less than two we will continue the loop and Betances will, "Keep the same game plan." The first time through the loop napoliHRsVsBetances is zero so we tell Dellin to keep the same game plan. We then add one to the napoliHRsVsBetances variable and restart the loop.
The second time through the loop the one homer by Napoli off of Beteances we have is still less than our cutoff of two, so Dellin can stay with the game plan. Because we are still less than our cutoff of two homers, we use the operator shorthand (++) to add one more to the number of Napoli homers versus Betances which is now up to two.
Now what happens? Now that napoliHRsVsBetances = 2 and our cutoff is two, the loop stops running. Why? Because it is no longer true that Napoli's number of homers off of Betances is less than two. At this point it is equal to two. So now, according to our loop, Betances should change up his approach to Napoli.
Challenge: Create a while loop for your favorite pitcher and his hitting nemesis and tweet it to me (@randallmardus).
On Deck: While Loops & Control Transfer Statements