What is return | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

What is return

I donā€™t understand differences between return and Console.Write

23rd Feb 2021, 6:46 PM
Codelearner
5 Respostas
+ 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