Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Basics (2015) Shopping List App Continue

Virochaan Ravi
Virochaan Ravi
6,940 Points

how do you skip

HOW do I skip the function.

breaks.py
def loopy(items):
    # Code goes here

1 Answer

If i understand your question correctly then by "SKIP the function" maybe you meant to terminate the execution of the program at a certain point.

If so, lets consider it this way.

def function(argument):
    return argument+argument;
    control doesn't reaches here.
    no matter what you write here
    what's written after return is not processed once the return statement is reached in a function.

In above code, the function returns certain value, so to end the execution we make it return something and control doesn't passes through it.

Now, but what if a function returns "nothing", so make it stop executing further we can return "nothing"

def function(argument, or_no_argument):
    return ;
    argument +=1;

Hope i understood your question correctly and this helps! if not please comment so.