Return function

kindly help me to understand what does basically return do and what is the main difference between void and int and when to use them ?

Hey @anisha2001singhal,
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.

void specifies that the function does not return a value. int specifies that the function returns an integer value.

when you don’t want to return any value you should use void and when you want to return an interger value you should return integer

1 Like