What would happen if a country bans the trading of its currency against foreign currency? The iranian rial has been losing its value rapidly recently. The dollar went from 40,000 rials to 60,000 rials in less than 6 month, most of the loss of value happening in the last few weeks. Iran responded by banning the trade of its currency until further notice. 

I wanted to ask the economists here their opinion on the implication of this ban? Also example of precedents of such bans by other nation states would be appreciated. 

news source: 
https://en.radiofarda.com/a/iran-ban-sale-foreign-currency-exchange-bureaus/29168476.html
This is quite a common response to an exchange rate crisis (which normally also suggests broader economic problems).  The consequences depend on how diligently the government applies the ban, the relationship between government and businesses that trade internationally and how far the official rate strays from the true (black market) rate.

First, it is almost always possible to buy and sell currency on the black market, and perhaps legally in neighbouring countries.  The black market rate is likely to follow the downward trajectory of the currency prior to the ban.  Exchange controls create risk for currency traders, so buying and selling on the black market tends to be expensive (i.e. the rates for buying and selling move further apart).

Second, lots of businesses urgently need foreign currency to import inputs and goods for retail sale.  They will try and find a strategy for obtaining that currency.  They may be able to buy it on the black market.  If the government is able to sell some local currency at the official (overvalued) rate, it may also sell foreign currency at the official rate to firms it sees as a priority (e.g. oil importers or friends of the regime).  For instance, tourists entering East Germany were forced to buy a certain quantity of local currency per day of their visit at the official rate, giving the government a source of forex.  If these strategies are not possible, companies may try to create symmetry in their import/export businesses, so that they can use the foreign exchange they earn themselves to cover their imports.  Government may or may not intervene to prevent this.  Importing firms without a viable strategy are likely to fail.

All in all it makes international trade more difficult and expensive, so prices of imported goods are likely to rise even more quickly than they were under the sliding exchange rate.

The most reasonable motivation for this type of exchange control is to prevent people and companies from shifting their savings into another currency, which could cause a general banking collapse.  If you see the exchange rate falling continuously, you would be tempted to convert your savings from local currency to dollars, which hold their value.  If everyone does this, the exchange rate slide accelerates, banks can't cover their liabilities, loans are called in, and banks and businesses may fold.

The Soviet bloc is a common example of the use of official exchange rates but they've been used by governments in trouble all over the world, recently in various African countries, a few in South America and less recently in Asia.