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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s