Quote:
Originally Posted by Vince
I generally don't do nested ifs. Especially not 10 levels deep. Instead of doing this:
pawn Код:
if(foo()) { if(bar()) { // possibly 100 lines of code } else return SendClientMessage(playerid, -1, "Not Bar"); } else return SendClientMessage(playerid, -1, "Not Foo");
I do this:
pawn Код:
if(!foo()) return SendClientMessage(playerid, -1, "Not Foo");
if(!bar()) return SendClientMessage(playerid, -1, "Not Bar");
// possibly 100 lines of code
|
Thank you Vince, i've rescripted it using your method and it looks easier now and its optimized