Some questions
#6

Quote:
Originally Posted by Sjn
Посмотреть сообщение
Thanks for answering people. Appreciated.



I know I have to use it inside a loop. That was just an example. However, can you tell me in which condition continue; is needed? I kinda didn't understand Mencent's answer.

Also, do I have to use break; to stop every loop? Even while using foreach. No matter if it's a small code or a large one.
Credits to Dice7 for this infinite loop but I hope you understand from this code what would it do
PHP код:
new var = -1;
while(
1//unlimited loop
{
    var++;
    if(var == 
5//if var is 5, then the printf and the "if var =10" check will be skipped
    
{
        continue;
    }
    
printf("%d", var);
    
    if(var == 
10//if var is 10, the loop will break
    
{
        break;
    }

Reply


Messages In This Thread
Some questions - by Sjn - 03.02.2016, 17:51
Re: Some questions - by TwinkiDaBoss - 03.02.2016, 17:58
Re: Some questions - by Mencent - 03.02.2016, 18:03
Re: Some questions - by SickAttack - 03.02.2016, 18:08
Re: Some questions - by Sjn - 03.02.2016, 18:15
Re: Some questions - by TwinkiDaBoss - 03.02.2016, 18:21
Re: Some questions - by Alcatrik - 03.02.2016, 18:23
Re: Some questions - by PrO.GameR - 03.02.2016, 21:33
Re: Some questions - by Sjn - 04.02.2016, 18:20

Forum Jump:


Users browsing this thread: 1 Guest(s)