This is the en dash. It is commonly used to indicate a closed range of values (e.g. 1977–1981), to contrast values or illustrate a relationship between two things (e.g. Boston–Hartford route) and in compound (phrasal) attributives in which one or both elements is itself a compound (e.g. Pulitzer Prize–winning novel). En dashes normally do not have spaces around them, except when used around parenthetical expressions – such as this one – or when avoiding spaces may cause confusion or look odd. The en dash is sometimes used as a substitute for the minus sign, when the minus sign character is not available and the hyphen-minus is too narrow to be typographically acceptable.
This is the em dash. It often demarcates a break of thought or some similar interpolation stronger than the interpolation demarcated by parentheses, or to indicate that a sentence is unfinished because the speaker has been interrupted. Furthermore, the em dash can be used where a full stop (or “period”) is too strong and a comma too weak. According to various style guides, an em dash should always be set closed, meaning it should not be surrounded by spaces—unlike the en dash and its open-set style in running text. Em dashes are also occasionally used to introduce quoted text, if the quotation dash is unavailable or is contrary to the house style being used.