0

What is the using of "return" in python

I'm confused whit thé using of return

22nd Mar 2019, 11:20 PM
yves houedande
yves houedande - avatar
9 Answers
+ 6
yes, but if you assign that function to a variable like this. x = return_func() it's the same as x = print("hello world") which you dont want.
22nd Mar 2019, 11:53 PM
LONGTIE👔
LONGTIE👔 - avatar
+ 5
return is typically use to "return" value from a function. def return_func(): return "hello world" print(return_func()) x = return_func() print(x) Output: hello world hello world no code will be executed after the return statement, so be aware
22nd Mar 2019, 11:35 PM
LONGTIE👔
LONGTIE👔 - avatar
+ 4
None is like null in c++ or js, it means to be "no value"
23rd Mar 2019, 12:15 PM
Flandre Scarlet
Flandre Scarlet - avatar
+ 4
I mean , "None in python" is like "null in c++ or js"
23rd Mar 2019, 12:25 PM
Flandre Scarlet
Flandre Scarlet - avatar
+ 3
yves houedande if you didn't return anything, the returned value will be None
23rd Mar 2019, 4:29 AM
Flandre Scarlet
Flandre Scarlet - avatar
0
Ok so If i do Def return_func(): Print("Hello World") Output: Hello World
22nd Mar 2019, 11:40 PM
yves houedande
yves houedande - avatar
0
What is none exactly
23rd Mar 2019, 12:12 PM
yves houedande
yves houedande - avatar
0
Ok thanks,but is it the same int Python language
23rd Mar 2019, 12:23 PM
yves houedande
yves houedande - avatar
0
Okay
23rd Mar 2019, 12:28 PM
yves houedande
yves houedande - avatar