Skip to content
Advertisement

Missing return value on Void method?

The following code gives me compile-time errors: missing return value and missing return statement, what value would I return for this Void Type?

JavaScript

Advertisement

Answer

Void is not void, change it to void type if you don’t want to return anything.

Void is a class, void is type.

JavaScript

If you want Void, then you need to add return statement at end.

Example:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement