Post navigation

Mini Update: Continue vs Break

After attempting to crash my computer with an infinite loop, I understand the very important difference between the Break statement and Continue statement.

What the definitions said:Continue ~ “breaks the current iteration of the loop”, only if a certain condition is met, then continues on within the loop.Break ~ “breaks the loop” and continues on to what’s after it (it being the entire loop).

What I interpreted:Continue ~ Stop petting this bear. Leave this cave. Go find the next cave. Start petting the bear in there.Break ~ Stop petting the bear because he’s getting really damn cranky. Matter of fact, get the hell out of there. Leave the entire cave system alone. Go find a cute little squirrel to chase.