SA-MP Forums Archive
Two types of Loop - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Other (https://sampforum.blast.hk/forumdisplay.php?fid=7)
+--- Forum: Everything and Nothing (https://sampforum.blast.hk/forumdisplay.php?fid=23)
+--- Thread: Two types of Loop (/showthread.php?tid=302851)



Two types of Loop - iPLEOMAX - 10.12.2011

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?


Re: Two types of Loop - Sinc - 10.12.2011

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.


Re: Two types of Loop - Lorenc_ - 11.12.2011

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



Re: Two types of Loop - THE_KNOWN - 11.12.2011

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


Re: Two types of Loop - Bakr - 11.12.2011

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.


Re: Two types of Loop - Babul - 11.12.2011

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?