Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to exit a function python

#Just do return
quit = True

def example():
  if quit:
    return

print(example())
#Doesnt output anything

#Or if you want an out put from the function

def example2():
  return (1+1)

print(example2())

#Outputs 2
Source by www.hashbangcode.com #
 
PREVIOUS NEXT
Tagged: #exit #function #python
ADD COMMENT
Topic
Name
5+8 =