Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 7 Online
OpenStudy (anonymous):

hi can someone pls explain the return command in detail for me with an example that will simplify it for me pls i need to understand the return command to be able to write a good function code

OpenStudy (rsmith6559):

When a function reaches a return statement, it ends the function. A return statement can specify a value to return from the function. If no value is specified, the value None will be returned. More than one return statement can be in a function, but the function ends the first time a return statement is executed. >>> def tf( bool ): ... if( bool ): ... return True ... return ... >>> if( tf( True ) ): ... print "Hello World" ... else: ... print "Goodbye World" ... Hello World >>> if( tf( False ) ): ... print "Hello World" ... else: ... print "Goodbye World" ... Goodbye World >>>

OpenStudy (anonymous):

tnx for the well detailed explanation just what i needed

OpenStudy (rsmith6559):

You're very welcome!

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Arriyanalol: i need help
17 hours ago 7 Replies 1 Medal
Arriyanalol: CONGRATS to me
20 hours ago 8 Replies 2 Medals
Legomaster346: What colleges are good that are near Arab Alabama?
1 week ago 5 Replies 0 Medals
Arriyanalol: i need help
1 week ago 6 Replies 2 Medals
Arizona: does anyone know the percentage rate of 30,000 and 40,000
1 week ago 0 Replies 0 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!