+ 2
New ideas for loops?
Are ther any other possibilities of loop keywords except if, while, until, unless, case, for, foreach, repeat?
3 Antworten
+ 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.
+ 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++.
+ 1
goto is control transfer not a loop