[Ajuda] Pequena dъvida sobre o 'return 0'.
#1

Desde quando eu comecei a aprender pawn, eu nunca soube realmente o que й o return...
Eu simplesmente sei que serve pra retornar...
Exemplo, em um comando.
If(!IsPlayerAdmin) return SendClient...
Na maioria das vezes eu utilizo o return 1, sem mesmo saber porque nгo colocar o 0.
Eu, pensando nisso e vendo a include do Lуs, vi isso:
pawn Код:
stock LerLog(const File[])
{
    if(!fexist(File))
    {
        printf("Esse arquivo nгo existe, utilize CriarLog(\"arquivo\"");
        return 0;
    }
    new string[100];
    new File:Arquivo = fopen(File, io_read);
    while(fread(Arquivo, string))
    {
        printf("[ %s ] %s", File, string);
        return 1;
    }
    fclose(Arquivo);
    return 1;
}
E vi o "return 0" no primeiro if, e fiquei me perguntando: pra que serve realmente o return 0 e o que aconteceria se nгo existisse o return 0 ou 1.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)