Home > Software engineering >  Having some trouble with a 'continue' and 'break' error in my code
Having some trouble with a 'continue' and 'break' error in my code

Time:10-04

enter image description hereokay so this a question on quiz I am taking currently. I don't want to know the answer I just want to know why I keep getting an error when I try to use break or continue in my loop. Is it a syntax thing or did I just format my loop wrong? Again no spoilers just want some guidance so I can get past this. thanks for any and all feedback

here is my code:

code

CodePudding user response:

The continue function cannot be used unless it is in a loop, and you currently do not have a loop. Loops are typically created with "for" or "while".

Using "for" or "while" would help you immensely, especially since your current code wouldn't check the numbers from zero to 100, but rather just the number 100.

I recommend using or researching the modulo(%) operator, as that would work well in this situation.

If you really get stuck, here is a solution to the problem, along with an explanation for what each line is doing: solution

  • Related