Https://www.codecademy.com/courses/introduction-to-blockchain/lessons/blockchain-in-python/exercises/checking-broken-chain

https://www.codecademy.com/courses/introduction-to-blockchain/lessons/blockchain-in-python/exercises/checking-broken-chain
def validate_chain(self):

for i in range(1, len(self.chain)):

  current = self.chain[i]

  previous = self.chain[i-1]

  if(current.hash != current.generate_hash()):

    print("The current hash of the block does not equal the generated hash of the block.")

    return False

  if(current.previous_hash != previous.generate_hash()):

    print("The previous block's hash does not equal the previous hash value stored in the current block.")

I dont understand here that how does this validate function work