Top "Return-type" questions

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

Dynamic Return Type in Java method

I've seen a question similar to this multiple times here, but there is one big difference. In the other questions, …

java dynamic return-type
PHP 7 interfaces, return type hinting and self

UPDATE: PHP 7.4 now does support covariance and contravariance which addresses the major issue raised in this question. I have run …

php interface return-type php-7 type-hinting
Can a C# method return a method?

Can a method in C# return a method? A method could return a lambda expression for example, but I don't …

c# methods lambda return-type
Return CompletableFuture<Void> or CompletableFuture<?>?

I want to write an asynchronous method that returns a CompletableFuture. The only purpose of the future is to track …

java future return-type completable-future
What's the difference between returning void and returning a Task?

In looking at various C# Async CTP samples I see some async functions that return void, and others that return …

c# asynchronous task-parallel-library return-type async-ctp
Should I use Unit or leave out the return type for my scala method?

I am not sure what the difference is between specifying Unit as the return type of my scala method or …

scala void return-type
PHP return type

Is it possible to define the return type like this? public static function bool Test($value) { return $value; //this value …

php return return-type
What does Void return type mean in Kotlin

I tried to create function without returning value in Kotlin. And I wrote a function like in Java but with …

java kotlin void return-type
Why can't 'kotlin.Result' be used as a return type?

I've created a method, and the return is Result<R> in a class of MyClass<R>, …

function kotlin return-type
Different return types of abstract method in java without casting

I am trying to implement and override a method with different return types without being forced to cast the return …

java methods abstract return-type