Why is the void data type used for the function if the output is a string? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why is the void data type used for the function if the output is a string?

2nd Aug 2016, 3:42 AM
Ian Dillon
Ian Dillon - avatar
5 Answers
+ 2
I think there might be some terminology confusion. Output is *not* return type. Output is what you write to console or file an return type is what a function returns to its caller.
2nd Aug 2016, 8:44 AM
Stefan
Stefan - avatar
0
it only holds data, which means it doesn't a specific return type, which also means that it can hold any data type.
2nd Aug 2016, 6:42 AM
john cariño
john cariño - avatar
0
The function itself won't output anything once it has run through. Void type functions don't return anything. Within the function though you can output any type you want.
2nd Aug 2016, 2:55 PM
Jebba Maxed
Jebba Maxed - avatar
0
It holds particular data... but have no return type..
6th Aug 2016, 2:44 PM
Sabbir Ahmed Shibli
Sabbir Ahmed Shibli - avatar
0
@Sabbir: Again, an answer that is misleading... What particular data does the function hold? Also, OP did not specifically say it's the return type... Pls try to improve on your answers.
6th Aug 2016, 2:50 PM
Stefan
Stefan - avatar