Question Info Function: break
#1

Hello,

can explain me the function
PHP код:
break 
?

this function block / stop the loop ?
Reply
#2

pawn Код:
public OnFilterScriptInit()
{
    for(new i = 0; i < 100; ++i)
    {
        printf("%i", i);
        if(i == 50)
        {
            break;
        }
    }
    return 1;
}
Will print: 0 1 2 3 4 5 6 ... 50
When i = 50, will stop the loop.

Understand?
Reply
#3

Or in other words - function "break;" stops the loop anytime you want before it finishes.

EDIT: I didn't see one sentence of poster above.
Reply
#4

Quote:
Originally Posted by Pedro_Miranda
Посмотреть сообщение
pawn Код:
public OnFilterScriptInit()
{
    for(new i = 0; i < 100; ++i)
    {
        printf("%i", i);
        if(i == 50)
        {
            break;
        }
    }
    return 1;
}
Will print: 0 1 2 3 4 5 6 ... 50
When i = 50, will stop the loop.

Understand?
yes, thanks

Thanks all.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)