Confusion about return types? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Confusion about return types?

What would happen if I use a non-void return datatype in a function yet it don't return any value?

25th Jun 2017, 11:18 AM
Sankara Narayanan
Sankara Narayanan - avatar
3 Answers
+ 4
⚠️ compile error
25th Jun 2017, 11:31 AM
NSA94
NSA94 - avatar
+ 2
duplicate question
25th Jun 2017, 1:16 PM
Thanh Le
Thanh Le - avatar
+ 1
Example? If you return something like it or String it will show an error saying that it is expecting a return type. Only in void you don't have to use the return key.
25th Jun 2017, 11:32 AM
Limitless
Limitless - avatar