system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5 : What happens when a country goes bankrupt?

Recently I just read about Sri Lanka going bankrupt so what happens next?
gpt
This is a very complex thing to describe in an ELI5. Each case will have their own specifics. Countries don't go bankrupt like companies or individuals because they cannot run out of their own currency since they can print as much of it as they choose. A "bankrupt" country is one where the government runs out of foreign currency. Foreign currency is needed to pay debt borrowed and to facilitate trade ie if a country wants to buy stuff from another country, they have to pay in a foreign currency.

What happens next is that, for most countries, the first agency that comes to their aid is the IMF. The IMF gives emergency loans to prevent the local currency from getting out of control. (It is a Monetary Fund). The IMF will help the country renegotiate their debt in return for policy changes (ie the government should not waste the money loaned to it by the IMF). 

The next step is usually, but not always, the World Bank or similar. This organization might help out with longer term funding or for certain development projects undertaken by the government usually if there are poverty alleviation projects. 

Internally, it is more challenging. Many (democratic) governments that go bankrupt are voted out of office. The citizens don't like governments that go broke. In the best circumstances the new government undertakes economic reform etc etc. In the worst cases, even the IMF cannot do much and the country spirals into violence and civil unrest. 

In many cases, the IMF and World Bank (and other aid organizations) try to provide enough funding to avoid outcomes like mass hunger, complete collapse of the economy and/or rapid increases in poverty but that is sometimes only possible after some time in a pretty bad situation. The actual economic steps vary by country.