+ 1

what does return do?

What does 'return' do?

1st Nov 2017, 11:37 PM
Sean Alvarado
Sean Alvarado - avatar
6 ответов
+ 14
def whatDoesItDo(): return "I don't know" print(whatDoesItDo())
2nd Nov 2017, 3:30 AM
Ahri Fox
Ahri Fox - avatar
+ 5
It is a keyword in Python that can only be used in functions to terminate a function and return a value
2nd Nov 2017, 3:35 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 3
Return a value or variable content
2nd Nov 2017, 12:03 AM
Daniel
Daniel - avatar
+ 1
So for example: Def hello(): Return ("hello") Hello() This returns the "hello" ?
2nd Nov 2017, 8:11 AM
Sean Alvarado
Sean Alvarado - avatar
+ 1
Yes Sean but you must to take care about indentation (tabs and spaces at the begining of the line) def hello(): Return ("hello") Hello()
2nd Nov 2017, 12:27 PM
Daniel
Daniel - avatar
+ 1
Ahh thanks alot guys.
2nd Nov 2017, 2:05 PM
Sean Alvarado
Sean Alvarado - avatar