Never forget a return statement


Mathematics defines a function as something that returns something upon some input. For us, the programmers, it is not just so… what we call function, in C family of programming languages, is rather a procedure from our perspective.C like languages have a rule that, a function must have a return type, and many internal implementation of different platforms depends upon them; and these return types are not always just void, so you might have to return something. But, as a matter of fact, these return values don’t mean anything in many cases. Many function always return the same value, just a success code or Boolean true or something like that. So, programmers overlook its importance or even existence while dealing with such numb functions. So did I today. As a result, i had to dig my head into wall and in vain. What I found at last, that I missed a single last statement, the return – pretty dirty thing 😦

dont forget the return

Guess what? this is another Aesop’s fable and the moral of the story is, Never forget a return statement, not even when it is dumb.

Now what? I’m the guy who suggest a lot, so let me pose a suggestion, “write a return statement in the very moment you type the braces of the function; return statement shall be the first code you do in your function”.

Duh, it is enough for now let me log off!

return bye;

Advertisements

2 thoughts on “Never forget a return statement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s