Created
September 5, 2013 05:29
-
-
Save kryptykphysh/6446380 to your computer and use it in GitHub Desktop.
Showing how a Python return value needs to be inside the body of a function.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Working function | |
def my_function(parameters): | |
# Body of the function goes here | |
return 'stuff returned' # Note, this has to be indented fourspaces to be inside the function. | |
# This function returns a Syntax Error | |
def my_function(parameters): | |
# Body of function | |
return 'stuff returned' # This returns a Syntax Error as the return statement | |
# is outside the function definition. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for this- the indentation of some commands is a real bugger! I thought this sort of strict formatting went out with cassette tapes! I'll get used to it- just need a little list of rules that makes sense to me.