What means the "return" anything ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What means the "return" anything ?

we use void main() and int main().I. know these are difference. And if we use void(), it won't be return anything and if we use int(), it will be return integer but actually i confused the "return" 's means. can you explain with details?

26th Nov 2016, 9:09 PM
Mücahit Doğan
4 Answers
+ 1
A return type identifies the type of data the function will deliver to you after ececution
26th Nov 2016, 9:42 PM
Andreas K
Andreas K - avatar
+ 1
Well, in programming there are methods. Methods can return something or not return anything. First ones are called functions, second - procedures. In some languages (not c#) procedures must return integer value. So, if you want to do something then you write a procedure. If you want to get some value then you write a function.
26th Nov 2016, 9:57 PM
Ivan G
Ivan G - avatar
+ 1
A return statement causes the execution to move from the current subroutine and resume at the point in the code immediately after the subroutine was called.
26th Nov 2016, 10:24 PM
Ankush Anshuman
Ankush Anshuman - avatar
+ 1
A method with a return type other than void is simply used to return a certain value after that particular method does what its suppose to do. Actually you can even use the "return" keyword with void return type but in this case its not used to return a value but rather exit the method.
27th Nov 2016, 12:04 AM
Ousmane Diaw