New ideas for loops? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

New ideas for loops?

Are ther any other possibilities of loop keywords except if, while, until, unless, case, for, foreach, repeat?

12th Aug 2018, 1:37 PM
Stanislav Vladev
Stanislav Vladev - avatar
3 Answers
+ 4
Stanislav Vladev More precisely, unconditional transfer control and no one didn't say it's a loop. If you had a chance to look into some assembly code then you could've been understood what's make a loop works as a loop.
12th Aug 2018, 8:08 PM
Babak
Babak - avatar
+ 2
Probably goto and labels. const int Max = 10; int index = 0; Repeat: // body of the loop // do stuff here. ++index; if (index < Max) goto Repeat; else goto End; End: ; After all, every loop boils down to assembly instructions containing jumps and labels after compilation in C/C++.
12th Aug 2018, 2:04 PM
Babak
Babak - avatar
+ 1
goto is control transfer not a loop
12th Aug 2018, 6:20 PM
Stanislav Vladev
Stanislav Vladev - avatar