Two types of Loop
#1

Hey guys, this is probably a stupid question But I need two words for these:

Loop Method 1
1..2..3..4..5..6 then 1..2..3..4..5..6 and on...

In this method, Numbers change from 1 to 6 then restarts from 1 after ending.


Loop Method 2
1..2..3..4..5..6..5..4..3..2..1 and on..

Here, Numbers change from 1 to 6 then moves from 6 to 1.

What are the particular words in English these method of loops?
Reply
#2

Quote:
Originally Posted by iPLEOMAX
Посмотреть сообщение
Hey guys, this is probably a stupid question But I need two words for these:

Loop Method 1
1..2..3..4..5..6 then 1..2..3..4..5..6 and on...

In this method, Numbers change from 1 to 6 then restarts from 1 after ending.


Loop Method 2
1..2..3..4..5..6..5..4..3..2..1 and on..

Here, Numbers change from 1 to 6 then moves from 6 to 1.

What are the particular words in English these method of loops?
First one may be considered recursion. The second one (i assume) is an increase, fixed point, then decrease to the original.
Reply
#3

pawn Код:
redo_Loop:
for(new i; i != 6; i++)
{
    if(i == 6) goto redo_Loop;
}
Reply
#4

pawn Код:
redo_Loop:
for(new i; i != 6; i++)
{
    if(i == 6) goto undo_Loop;
}

undo_Loop:
for(new i=6; i != 0; i--)
{
    if(i == 0) goto redo_Loop;
}
from lorenc_ ;p
Reply
#5

Why would you use a goto loop in that situation?
pawn Код:
for(new i; i < 7; i++)
{
   if( i == 6 ) i = 0;
}
Also, he asked for the name of them, no the code.
Reply
#6

i would consider the second loop like a "boucing" or "shaking" method. its used in the "shaker sort". hm. maybe you could say "back and forth" loop?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)