So I was writing a function to check who has won in tic-tac-toe after each move. In the game we don't need to check who has won for first four moves. So, as in the function I added this check like this:
fn check(self) -> Result {
if self.total_moves > 4 {
//check the winner
} else {//no one win
}
}
But, once the total moves gets more than 4. We can see that self.total_moves > 4
always passes. It doesn't need to check again and again. So, how to rewrite the code so that once total moves get more than 4, we don't have to check it anymore.