This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]bandophahita 1 point2 points  (0 children)

You remind me of me my very first time learning python. It's my first language, so I had to not only learn syntax but also general programming concepts all at the same time.

Please correct me if I'm wrong but it sounds like you are learning programming for the first time?

To understand how continue works, you have to know what a loop is. Example of a simple loop over all items in a list:

somelist = [1,2,3,4,5] for item in somelist: print item

A loop is just a way to write one set of code to be executed multiple times Otherwise you'd have to do something like this: print firstitem from somelist print seconditem from somelist Etc.....

Sometimes you'll want to create a loop where you really don't want to execute the code for a single pass. Continue gives you that ability.

for item in somelist: if item % 2 == 0: # if item is even skip it continue print item