+ 1

What is return

I don’t understand differences between return and Console.Write

23rd Feb 2021, 6:46 PM
Codelearner
6 Respuestas
+ 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.
23rd Feb 2021, 6:56 PM
Wilbur Jaywright
Wilbur Jaywright - avatar
+ 3
return "returns a value(s) to the calling function/method. Console.Write() is standard method to display output in the standard console output.
23rd Feb 2021, 6:58 PM
Jayakrishna 🇮🇳
+ 2
You can say a function has a return type which is either int , float, double, or char etc.
25th Feb 2021, 9:59 AM
ram roop Passionate to Learn Coding
ram roop Passionate to Learn Coding - avatar
+ 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 :-)
23rd Feb 2021, 6:59 PM
Wilbur Jaywright
Wilbur Jaywright - avatar
+ 1
Wilbur Jaywright "Return" You Win.
23rd Feb 2021, 7:28 PM
Daniel Briceño
Daniel Briceño - avatar