+ 1
What is return
I don’t understand differences between return and Console.Write
6 Antworten
+ 4
I think this is a duplicate question, but I will answer. Console.write or print or debug (in various languages) writes the given text to some kind of display. return on the other hand submits the result of a function or method to the outer code scope, rather than displaying it to a user.
+ 3
return "returns a value(s) to the calling function/method.
Console.Write() is standard method to display output in the standard console output.
+ 2
You can say a function has a return type which is either int , float, double, or char etc.
+ 1
further: i searched “return vs. print” in Hot Today, and came up with three of the same question. so for future reference, use the search bar, but remember to switch it to something like “hot today“ or “trending“ so it will work correctly. That one has got me a few times :-)
+ 1
Wilbur Jaywright "Return" You Win.