Today I’ve received a small ActionScript 3 application that I need to have a look at and make some changes to.
I’ve noticed that the entire application is riddled with the return keyword, eg:
// Constructor
public function MyClass()
{
// some logic
return;
}
public function someFunction():void
{
// some logic
return;
}
Is there a possible reason for this, or is the developer who worked on this using some weird, self-taught practice?
returncan end a function early if condition is met, the appropriate information has been assigned or passed, etc. while the function has additional code that is not needed, but if all of thevoidfunctions just havereturnat the end of the function then they are redundant.