Lowest price ever! Learn Generative AI for 48% less!
Get my discount+ 4
Can we have different return types for a function if it has more than one data type passed to it?
If we compare an integer and a floating point number, can we have different return types matching that of the variable?
6 Answers
0
Prabhanshu Chaturvedi Same thing goes for Java. Example of languages that support multiple return values are Python, Go and Swift
+ 4
C++?
+ 4
Ok. Thank you. Is it possible in Java?
+ 4
Oh, I see. Thank you again.
0
It is possible in some languages and impossible in others. So please specify which language?
0
Prabhanshu Chaturvedi C++ does not support multiple return values but you can place the values in a tuple and return the tuple