You did this the first time and it worked! But then you put weight back on.
So you did it a second time and the weight came off. What do you think is going to follow? This isn't the way to diet!
It could, but that doesn't mean it did. You've gotta know that insufficient nutrients make us sick in many ways, we eat because our bodies and organs need a proper array of nutrients. People who fast for long periods of time suffer all kinds of problems, including with cognition, and if they do it long enough it can be permanent. But it can also be not a bit deal at all, depending on the inherent strength of the person. Starving oneself is not a good way to diet, it is temporary, and the body does need to feed itself to function optimally.