Switch + else?
#1

Is following possible:


pawn Код:
switch(casenr)
{
    case 1:
    {
        blabla case stuff
    }

}
else return SendClientMessage(playerid, COLOR_GREY, "INVALID CASE#");
return 1;
I'm not sure if a switch works with "else".
Reply
#2

It doesn't, but default does.

pawn Код:
switch ( casenr )
{
    case 1:
    case 2:
    default: // if case 1 and case 2 fail
}
Reply
#3

Quote:
Originally Posted by [NoV]LaZ
Посмотреть сообщение
It doesn't, but default does.

pawn Код:
switch ( casenr )
{
    case 1:
    case 2:
    default: // if case 1 and case 2 fail
}
Superb, thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)