9951 explained code solutions for 126 technologies


pythonHow to break out of function


def my_func(param):
  if param == 5:
    return 0
    
  # other code in functionctrl + c
def my_func

name of example function

if param == 5

condition on which we want to break from function

return 0

breaks function execution and returns value (0 in our example)