|
|
This article does not cite any references or sources. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed. (December 2009) |
In computer programming, the return type defines and constrains the type of value returned from a method or function. In many programming languages (especially those that are statically-typed, such as Java, C++, C) the return type must be explicitly specified when declaring a function.
In the Java example:
public int someMethod()
the return type is int. The program can therefore rely on the method returning a value of type int. Various mechanisms are used for the case where a subroutine that does not return any value, e.g., a return type of void in some programming languages:
public void returnNothing()
See also
This entry is from Wikipedia, the leading user-contributed encyclopedia. It may not have been reviewed by professional editors (see full disclaimer)




