It tells me Im not near a gas station
#10

Quote:
Originally Posted by Vince
Посмотреть сообщение
I completely agree. I prefer to handle cases that would turn out to logically false first. One hundred nested if statements with 100 lines of code in between don't make the code anymore clear. You might want to read the part about 'no early returns' on the website I linked to in my signature; how to write unmaintainable code.
As far as the command should most of the times execute, and not return error, it is better to return the true first, and the false after.
Like, you can type 100 times /vr, and only 20 of them should return error, like You are not admin.

Guess you uderstend what i mean. Most of the times, the player fit all the ifs, making them return positiveinstead of error.
Reply


Messages In This Thread
It tells me Im not near a gas station - by milanosie - 09.02.2012, 19:36
Re: It tells me Im not near a gas station - by MP2 - 09.02.2012, 20:12
Re: It tells me Im not near a gas station - by milanosie - 09.02.2012, 20:15
Re: It tells me Im not near a gas station - by MP2 - 09.02.2012, 20:17
Re: It tells me Im not near a gas station - by milanosie - 09.02.2012, 20:22
Re : It tells me Im not near a gas station - by ricardo178 - 09.02.2012, 21:04
Re: It tells me Im not near a gas station - by milanosie - 09.02.2012, 21:05
Re: It tells me Im not near a gas station - by MP2 - 09.02.2012, 21:09
Re: It tells me Im not near a gas station - by Vince - 09.02.2012, 22:25
Re : Re: It tells me Im not near a gas station - by ricardo178 - 09.02.2012, 22:52

Forum Jump:


Users browsing this thread: 1 Guest(s)