I was told by my Japanese teacher that 「うん」 can be used as a casual way to say "yes" as well as "no." If this is true, how can you tell the difference, absent any additional information?
It's possible that your teacher was talking about how to respond to negative questions in Japanese. This is a good explanation for that.
In this case, though, I think your teacher was talking about うん vs ううん.
A straightforward うん with a falling intonation means yes. A lengthened ううん, often with high, then lower, then middle pitch can be used to express doubt, denial or disagreement (it may be helpful to ask your teacher to demonstrate).
As oldergod says, this is often used when answering a negative-question, but it doesn't have to be used this way. In my friend's copy of Genki I have seen something like:
B: うん、元気だった ／ ううん、元気じゃなかった