0
void/string return.? which is the best one
3 Answers
+ 5
If your function want "signal" something to caller, return a value else dont... Your function test print a string and return it but its unusefull return it
+ 5
when you use void it means that nothing will be returned back to the calling method although these methods mostly print to screen nothing is returned back to the calling method.
A method without void, returns.
so when you call the method the method will do somthing and return the result back to the method you called it from đ
also just to add that with void methods you dont need to declare a return type int,string ect as nothing is returned back but you still have to put parameters inside the parentheses if your passing a string or int to the method.
+ 1
thx for answer dude.
i just want to know, because as far as i know void willnot return any value inside it. meanwhile if i determine the return type it would make the method unique. thats what i though, correct me if its wrong. thanks