Umm what?
PHP Code:
function whatever(hi,hi) {
if(this==that) {
blah;
blah
if(true)
cool;
} elseif(yourmom) {
stuff;
morestuff;
} else somethingcoolhere;
}
Looks way nicer then
PHP Code:
function whatever(hi,hi)
{
if (this==that)
{
blah;
blah
if(true)
cool;
}
elseif (yourmom)
{
stuff;
morestuff;
}
else
{
somethingcoolhere;
}
}
But that is a preference thing. I personally think what you say is better looks more obnoxious.
also, you space too much, you can use spacing to help visualize order of operations. and padding the conditional statements is a waste.
PHP Code:
x = something/2 + somethingelse*3;
x = something / y^3;
d = ( (x1-x2)^2 + (y1-y2)^2 )^.5;
if(true) is better then if( true )
if(x == y) is better then if( x == y )
also, single line functions are okay as wrappers. Declare them at the top, looks nice.
PHP Code:
//dont know why you would ever need to wrap showimg but an example
function onShowImg(ind,img,ix,iy) showimg(ind,img,ix,iy);
function whatever() {
stuffhappens;
scheduleEvent(5,"ShowImg",201,"possums.png",x+2,y+1);
}
And i am going to agree with dusty on multilining if statements. if it needs to be that obnoxious, store booleans before the comparision.