Python If语句以及如何停止它

Python If语句以及如何停止它,python,Python,我有一个关于if声明的问题。函数中有一个if语句。在这里,我确定当我的变量小于0时,它应该只打印一个特定的句子,但在这里停止。因此,该函数不应继续并在此处停止。 我该怎么做 def __init__(self, business account ): self.business = business if account < 0: print('The balance is negative, therefore an account cannot be created

我有一个关于if声明的问题。函数中有一个if语句。在这里,我确定当我的变量小于0时,它应该只打印一个特定的句子,但在这里停止。因此,该函数不应继续并在此处停止。 我该怎么做

def __init__(self, business account ): 
  self.business = business 
  if account < 0:
    print('The balance is negative, therefore an account cannot be created!') #break 
  else:
    self.account = account
def\uuuu init\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
自我经营
如果帐户<0:
打印('余额为负数,因此无法创建帐户!')#中断
其他:
self.account=帐户

返回
停止函数。您可以返回一些内容,函数将终止。另外,问题有点不清楚,请尝试重新表述。

这就是
return
的目的。您需要添加一个代码示例以获得答案。def uu init_uu(self,business account):self.business=business if account<0:print('余额为负数,因此无法创建帐户!')#break else:self.account=accountAs在这里,这里#break现在在哪里。我怎么能停在这里呢?所以下面的代码应该在平衡时停止