Top "Return-type" questions

is for questions dealing with the type of the variable or value returned by a function.

php7 void return type not working?

I have a problem with return types in php7, specially "void". it works with all other types, int, string, null, …

php return-type type-hinting php-7
Why should functions always return the same type?

I read somewhere that functions should always return only one type so the following code is considered as bad code: …

python function return-type
Returning an objects subclass with generics

With an abstract class I want to define a method that returns "this" for the subclasses: public abstract class Foo { ... …

java generics subclass parameterized return-type
Why doesn't C# support the return of references?

I have read that .NET supports return of references, but C# doesn't. Is there a special reason? Why I can't …

c# .net reference return-type
What does a constructor return?

My question is what does a constructor return? This question is not quite different from "What is the return type …

c++ constructor return-type
ActiveRecord 'destroy' method returns a boolean value in Ruby on Rails?

I am using Ruby on Rails 3 and I would like to know what type of return will have the following …

ruby-on-rails ruby-on-rails-3 return-type destroy
Return dynamic table with unknown columns from PL/pgSQL function

I need to create a function that checks on a given table if the infowindow field exists. If it exists …

postgresql polymorphism plpgsql dynamic-sql return-type
String or StringBuilder return values?

If I am building a string using a StringBuilder object in a method, would it make sense to: Return the …

c# string return-value stringbuilder return-type
Why can I expose private members when I return a reference from a public member function?

In the code snippet, I am able to access the private member variable outside the class scope. Though this should …

c++ function return-type
How do I document :rtype: for a function that returns multiple possible data types?

In a Python docstring how should one document the :rtype: for a function that can return multiple possible data types? …

python return-type restructuredtext docstring