6 ответов
+ 4
return is used to "return" a value from a function. That value can be anything - an integer, string or even a tuple/dictionary
+ 3
return 20, return 30, return 100, return "abc", return "xyz".
No difference just difference in values
+ 2
Parsa Gharavi that would be a shallow understanding of `return`.
What if someone defines 0 as True and 1 as False?
+ 2
Infinity I know; You're right. I was just trying to explain the general idea.
+ 1
when you return 1, you are basically returning True as the final value of the function while return 0 is basically returning False as the final value of the function.
Negative 1 (-1) or any negative numbers that get returned show that the function couldn't find the output wanted (indexing).
0
Parsa Gharavi well explained