View Single Post
  #4  
Old 05-05-2011, 01:31 AM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
Quote:
Originally Posted by oo_jazz_oo View Post
I dont see a huge problem in using one line codes without brackets for certain instances.
PHP Code:
function check(xy) {
  if (
== y) return true;

Like in that instance. Does it really make it any more readable...any more efficient...any more anything by adding the brackets?
On first site I would say it was a mistake, and fix it to have brackets..
I agree not to teach like this, but if you are the only one ever going to touch your scripts.. I suppose it doesn't matter if it works for you.. lol

But if someone in the future may have to go over it.. Again it could confuse them... I'm not totally experienced in programming, so I don't know, others may be able to pick it up what it means faster.. Even if I did pick it up, I'd take the time to fix it towards a common style for others and myself in case I look at it again in the future.




Quote:
Originally Posted by salesman View Post
PHP Code:
function check(xy) {
  return 
temp.== temp.y;

This would return true if true? and if it isn't the same, it would still return false?


I'm only wondering because I would do:
this.variable = 0;
if (this.variable == 1){
dostuff();
}

I use 0 and 1.. and later on if I need to I can increase it if I want it to be 2, 3, or 4.. but even if it stays on and off, true or false, I still use 0 and 1.. should I start doing true and false for those special things that only use true or false?
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz



Reply With Quote