This text will be hidden
So I want to create a simple program where some shapes slowly change color from red to green, then to blue and then back to red. To do so, I created integers r, g and b and made a draw method that would always do r = r + 1 etc.
After the first “while”-loop I put a break because otherwise it would just stay green. Now, of course, it stops after the break, starts again and just stops again, but if I put the break later or try to rearrange it, it would either just stay one color or try to change from red to green and from green to blue at the same time. The only way around this would be, if I could start the second loop and break the first loop at the same time (Do you understand what I mean?).
Is it possible to do this?
(1. Sorry if I did something wrong or it isn’t clear what I’m trying to say, it’s my first time on this website
2. Sorry for my bad English
3. I’m pretty sure there are better ways to code this, but I’m a beginner and that’s the only way I can do it so far)[/details]
so, I would like to break the first “for”-loop after as soon as the condition for the first “if”-loop (r = 0 & g = 255) is completed. Then I would like to start the second “for”-loop. If I just put the break after the “if” it’s not working (because it’s trying to break the “if” loop I think…?)
Yup! Give it a try and if you stuck don’t hesitate to come back.
Also please don’t use images for code, instead please use the </> Button on the edit window an paste your code inside the marks. Makes easier for us to support.