TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   preventing for loops to repeat in while loops (http://www.talkphp.com/general/3361-preventing-loops-repeat-while-loops.html)

Orc 09-17-2008 05:09 AM

preventing for loops to repeat in while loops
 
How do I fix my for loops from repeating in while loops?

tony 09-17-2008 06:15 AM

do you mean you want to prevent for loops to run inside while loops? an example or the actual code would come in handy to illustrate the problem.

Orc 09-17-2008 06:23 AM

Quote:

Originally Posted by tony (Post 18401)
do you mean you want to prevent for loops to run inside while loops? an example or the actual code would come in handy to illustrate the problem.

I want to prevent for loops from repeating in while loops.

Salathe 09-17-2008 10:26 AM

If you don't want something to repeat, don't use a loop. I'm really not sure what's being asked here.

sketchMedia 09-17-2008 01:20 PM

A loop by definition is a block of code which is defined once but executed more than once in succession, hence the term 'loop'.

No idea what you mean, could you clarify if possible?

buggabill 09-17-2008 04:52 PM

You could wrap the for loop in an if block...

Without code it is hard to say though.

Orc 09-17-2008 07:35 PM

I'm making a calendar system, I haven't found any other way around it. By the way, I never have had to make a calendar system before so. xD

buggabill 09-18-2008 12:00 PM

I think what we are looking for is the actual code where the loop resides. Does it look something like this?

php Code:
while (someexpression) {
    for(stuff) {
    ...
    }
}

Do you wish to prevent the for loop from being executed every time through the while and only execute it sometimes?

"Need more input!" - Johnny 5


All times are GMT. The time now is 04:48 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0