programming languages - It's considered a bad pratice use return to end a function? -
i'm php , actionscript developer, , in of functions use return
end it. example:
private function lolsome(a:string):void { if(a == "abs"){return void;} // function's code }
i place function's code else
, prefer way because in opinion, more legible. want know if considered bad practice or that.
thanks!
i consider bad practice if have returns inside long complicated functions because can harder else understand algorithm when looking @ it. however, bad practice have big long functions in first place (they should split multiple smaller functions).
overall, consider validating parameters , state @ beginning of function , returning practice, not ok.
but still careful not litter function several different returns within main logic.
Comments
Post a Comment