I dont understand continue,break and return in python. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I dont understand continue,break and return in python.

plz help

1st Mar 2018, 5:10 PM
Bibek
Bibek - avatar
3 Answers
+ 2
In a loop, you have a certain amount of iterations (repetitions). If you have a break-statement in there, the rest of the loop will be skipped and the loop is over. If you have continue there, the rest of the cutrent iteration is skipped and the next one starts. You have break-statements also in switch-blocks to end a case.
1st Mar 2018, 5:21 PM
D B
D B - avatar
+ 2
If you are interested in learning Python then you should continue. If you're not able to understand it you can take a short break and revise basic concept of Programming then continue and you find XYZ Programming language much easier then leave Python and learn it.
1st Mar 2018, 5:19 PM
Ekansh
0
Return will give something to the ... that called the method (or without anything behind it, doesn't it act like break? Not sure about it...) That's how it is in Java, I think that applies to Python as well
1st Mar 2018, 5:22 PM
D B
D B - avatar