Unity Course: Learn Unity 5 at Your Pace on Udemy

What does it mean that void does not return? I am actually confused due to the fact that the function does return something which gets shown on the console …

It means that the function is not returning a variable to its caller after
its caller. The “print” functions don’t count as a return, as they’re
directly sending those commands to the console.
If it were returning something it would like something like this:

string PrintLine() {
string result = “Return this to caller”;
return result;

And to call it, you could use something like:

which would call the PrintLine function, and send the string that it
returns to the “print” function for the console.

1 Like

Privacy & Terms