What's return value really mean? Why return value called return value and how it works? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

What's return value really mean? Why return value called return value and how it works?

19th May 2019, 4:27 AM
D ̲E ̲S ̲S ̲I ̲E ̲- ̲B ̲A ̲H ̲I ̲R ̲U ̲
D ̲E ̲S ̲S ̲I ̲E ̲- ̲B ̲A ̲H ̲I ̲R ̲U ̲ - avatar
4 Réponses
+ 21
The return type of a function tells what kind of value a function is supposed to return to the point from where it is called. However, if you use 'void' as the return type of a function, it doesn't need to return anything. It just performs the work written through the code, and returns the control back to point from where it was called. ▪return x; causes the current function to return to the caller, evaluating to x. It is required except in functions returning void, in which case return; returns without a value. 
19th May 2019, 9:13 AM
Danijel Ivanović
Danijel Ivanović - avatar
+ 12
The return statement terminates the execution of a function and returns control to the calling function. Execution resumes in the calling function at the point immediately following the call. A return statement can also return a value to the calling function So it called return dramatically because of it's grammatical meaning , it means to stop where you are and turn back your way from where you came from and in our case we will come back to "the calling function" and as I said sometimes we don't turn back our way with empty hands , we can come back with a value so it may seem funny the metaphor but that what "return"really do
19th May 2019, 4:46 AM
Why So Serious ?
Why So Serious ? - avatar
+ 10
In most programming languages, the return statement is either return or return value, where value is a variable or other information coming back from the subroutine
19th May 2019, 4:52 AM
Why So Serious ?
Why So Serious ? - avatar
+ 4
return simply means to get the output of a function, you return a value back to were that function was called.
19th May 2019, 8:01 AM
D_Stark
D_Stark - avatar