Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.

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.