shorten a line like this?
#8

Quote:
Originally Posted by legodude
Посмотреть сообщение
pawn Код:
new Job=GetPlayerJobID(playerid);
if((Job >= 1 && Job <= 4) || (Job >= 8 && Job <= 13) || (Job >= 17 && Job <= 21))
maybe the case is faster. but i don't think so at this one...
someone test please?
Even if this was true the speed difference wouldnt affect anything at all, it would be VERY small of a difference. Also im pretty sure the switch is faster, as you have SIX variable accesses in the above code.


btw you know you can do this:

Код:
if((1 <= job <= 4) || (8 <= Job <= 13) || (17 <= Job <= 21))
this is a lot cleaner.
Reply


Messages In This Thread
shorten a line like this? - by xir - 18.03.2011, 16:13
Re: shorten a line like this? - by Kyosaur - 18.03.2011, 16:14
Re: shorten a line like this? - by Calgon - 18.03.2011, 16:16
Re: shorten a line like this? - by xir - 18.03.2011, 16:18
Re: shorten a line like this? - by Norck - 18.03.2011, 16:20
Re: shorten a line like this? - by Calgon - 18.03.2011, 16:22
Re: shorten a line like this? - by legodude - 18.03.2011, 16:24
Re: shorten a line like this? - by Kyosaur - 18.03.2011, 16:36
Re: shorten a line like this? - by Calgon - 18.03.2011, 16:40
Re: shorten a line like this? - by Norck - 18.03.2011, 16:49

Forum Jump:


Users browsing this thread: 1 Guest(s)