mercredi 18 septembre 2019

confusion with else block in python

I have confusion with my code. It is working fine in both cases but I want to know why it is correct. My main concern is for function return it supposes to be executed every time however it's not. Can anybody point what I am missing with the concepts?

    def is_empty(self):
    """
    check array is empty
    :return: true or false
    """
    if self.n != 0:
        return False
    return True

Aucun commentaire:

Enregistrer un commentaire