Citizendia
Your Ad Here

In computer programming, a return statement causes execution to leave the current subroutine and resume at the point the subroutine was called -- known as its return address. In Computer science, a subroutine ( function, method, procedure, or subprogram) is a portion of code within a larger In postal Mail, a return address is an explicit inclusion of the address of the person sending the message The return address is saved, usually on the process's call stack, as part of the operation of making the subroutine call. In computing a process is an instance of a Computer program that is being sequentially executed by a computer system that has the ability to run several computer In Computer science, a call stack is a dynamic stack data structure which stores information about the active Subroutines of a Computer program Return statements in many languages allow a function to specify a return value to be passed back to the code that called the function. In Computer science, source code (commonly just source or code) is any sequence of statements or declarations written in some Human-readable

In C++, return exp; (where exp is an expression) is a statement that tells a function to return execution of the program to the calling function, and report the value of exp. C++ (" C Plus Plus " ˌsiːˌplʌsˈplʌs is a general-purpose Programming language. An expression in a Programming language is a combination of values Variables operators and functions that are interpreted ( In Computer programming a statement can be thought of as the smallest standalone element of an imperative Programming language. If a function does not have a return type (i. e. , its return type is void), the return statement can be used without a value, in which case the program just breaks out of the current function and returns to the calling one. The void type, in several programming languages derived from C and Algol68, is the type for the result of a function that produces no direct result

In Pascal there is no return statement. Pascal is an influential imperative and procedural Programming language, designed in 1968/9 and published in 1970 by Niklaus Wirth as a small A subroutine automatically returns when execution reaches its last executable statement. Values may be returned by assigning to an identifier that has the same name as the subroutine (a function in Pascal terminology).

Certain programming languages, such as Perl and Ruby allow the programmer to omit an explicit return statement, specifying instead that the last evaluated expression is the return value of the subroutine. NOTES FOR EDITORS "Perl" is not an acronym (read the "Name" section below Ruby is a dynamic, reflective, general purpose Object-oriented programming language that combines syntax inspired by Perl with Smalltalk In Windows PowerShell all evaluated expressions which are not captured (e. Windows PowerShell is an extensible command-line shell and associated Scripting language from Microsoft g. assigned to a variable, cast to void or piped to $null) are returned from the subroutine as elements in an array, or as a single object in the case that only one object has not been captured. In Computer science, type conversion or typecasting refers to changing an entity of one Data type into another The void type, in several programming languages derived from C and Algol68, is the type for the result of a function that produces no direct result In Unix-like computer Operating systems a pipeline is the original software pipeline: a set of processes chained by their Standard Null has several meanings in Computer programming.;Null pointer or null reference Null is a special Pointer value (or other kind of object reference

Values returned by the program when it terminates are often captured by batch programs. In DOS, OS/2, and Microsoft Windows, a batch file is a Text file containing a series of commands intended to be executed by the

Syntax

Return statements come in many shapes. The following syntaxes are most common:

As used in C, C++, Java, PHP, C#, Windows PowerShell:

return value;

As used in Smalltalk:

^ value

As used in Lisp:

(return value)

As used in BASIC:

RETURN

As used in Visual Basic .NET

Return Value

Criticism

(Some developers and computer programming educators) eschew use of the explicit return statement except at the textual end of a subroutine - considering that, when it is used to "return early", it suffers from the same sort of readability problems as the GOTO statement. tags please moot on the talk page first! --> In Computing, C is a general-purpose cross-platform block structured C++ (" C Plus Plus " ˌsiːˌplʌsˈplʌs is a general-purpose Programming language. PHP is a computer Scripting language. Originally designed for producing Dynamic web pages it has evolved to include a Command line interface capability C# (pronounced C Sharp is a Multi-paradigm Windows PowerShell is an extensible command-line shell and associated Scripting language from Microsoft Smalltalk is an object-oriented, dynamically typed, reflective programming language. Lisp (or LISP) is a family of Computer Programming languages with a long history and a distinctive fully parenthesized syntax In Computer programming, BASIC (an Acronym for Beginner's All-purpose Symbolic Instruction Code) is a family of High-level programming languages Visual Basic.NET ( VBNET) is an object-oriented Computer language that can be viewed as an evolution of Microsoft's Visual Basic GOTO is a statement found in many computer Programming languages It is a combination of the English words go and to As with GOTO, there is a problem that in later development, a return statement could be overlooked by a developer, and an action which should be performed at the end of a subroutine (e. g. : a trace statement) might not be performed (in all cases).

Conversely,(Other developers) consider the return statement worthwhile when the alternative is more convoluted code, harming readability.

It is generally accepted that the return statement should not be considered as harmful as GOTO, since it only allows jumping to one particular place in the subroutine. In Computer science and related disciplines considered harmful is a phrase popularly used in the titles of diatribes and other critical essays (there are at least 65 such works Moreover, in popular contemporary programming languages, the return value of a function is usually explicitly specified in the return statement.

Also, in languages such as Java, the try. . finally construct can be used to always perform an action at the very end of a subroutine, after any return instruction has been executed. The finally clause will be executed even if an exception has been thrown (the exception is automatically caught, and then re-thrown after the finally clause has been executed, unless the finally clause itself throws an exception). Exception handling is a programming language construct or computer hardware mechanism designed to handle the occurrence of a condition that changes the normal flow of execution When used appropriately (e. g. for closing file handles), this avoids the need to either find all exit points and add redundant statements immediately before them, or to refactor the subroutine to remove return statements - both of which are potentially error-prone procedures.

Aspect-oriented programming can also be used to do a similar job to try. Aspect-oriented programming ( AOP) is a Programming paradigm that increases modularity by allowing the separation of Cross-cutting concerns . finally - with or without the automatic exception-catching behaviour - although it is intended more to concisely express behaviours which "crosscut" more than one subroutine.


© 2009 citizendia.org; parts available under the terms of GNU Free Documentation License, from http://en.wikipedia.org
Dapyx Software network: MP3 Explorer | Ebook Manager | Zenithic