• Octopus1348@lemy.lol
    link
    fedilink
    arrow-up
    3
    ·
    11 months ago

    It’s much more readable when you use else depending on the checks. You can still use return in an else block.

    def Allowed()

      if name == "Octopus1348": return True
    
      elif name == "Bobert": return True
    
      else:
            return "You are not allowed to use this script."
    

    print(Allowed())

    `