Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Yoo Song Won

What does the Return function do in Python?

Recommended Posts

Posted · Original PosterOP

Doing some school work in Python.

 

Just wondering what 'return Instruction' does in this subroutine. Why is it there? I see the return function occurs a lot throughout the program returning a variable of some kind.

 

image.png.a813ceca724ff8a08b762aebec4542d1.png

 

Thanks in advance!

Link to post
Share on other sites
Posted · Original PosterOP
1 minute ago, PeterBocan said:

It's a return statement, it returns the value within the variable called "Instruction"/

What do you mean by 'return'?

Link to post
Share on other sites

It sends the output of what's given for input back to the other function that called it.


Current Network Layout:

Current Build Log/PC:

Prior Build Log/PC:

Link to post
Share on other sites
Just now, Yoo Song Won said:

What do you mean by 'return'?

imagine function as being some sort of tube, a chunk of code that is separated and put aside to be used on many different places in your program. You put some inputs into it and you expect something back from that function.

Link to post
Share on other sites
Posted · Original PosterOP
20 minutes ago, PeterBocan said:

imagine function as being some sort of tube, a chunk of code that is separated and put aside to be used on many different places in your program. You put some inputs into it and you expect something back from that function.

 

22 minutes ago, Lurick said:

It sends the output of what's given for input back to the other function that called it.

Thanks a lot! You guys helped me understand it now!

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×