Iran has a dress code? I know women in most Islamic countries have a dress code but overall, and just Iran?
Iran and Saudi Arabia are two countries where the strict Islamic dress codes for men and women are the law of the land. Religious police patrol around and enforce the rules. Even foreigners and tourists have to abide (to some extent) by the religious rules-- it is not a choice. In most other Muslim countries, like Turkey, Senegal, Egypt and Indonesia, there are secular laws and people can wear traditional or modern clothing as they please.
Even in the really strict places, the dress codes have only been imposed by law since the 1980's. The Islamic crackdown is a modern phenomenon, seen as a reaction to the overwhelming military, political and cultural influence of the "decadent west".
Older women in strict Muslim countries (including Afghanistan) remember having much more freedom and more rights when they were younger than women and girls do today. Saudi women used to drive cars, Afghan women wore pants and mini-skirts, Iranian women danced to rock music and drank alcohol at parties; but none of that is allowed now.
It is like what the religious right would do in the US if they had the chance....