The best option is to find a more positive way of letting them out. If you hide them, people won't know what you're feeling or be able to help if you need it. That can be very worrying to some. Additionally, letting it out by ranting or yelling is upsetting to people, and instills bad habits by reinforcing a negative mindset. It isn't good for you to let your emotions dictate your reactions.
A good way of letting out your emotions is to first figure out how to deal with whatever situation is upsetting you. If someone made you upset, let them know that it bothered you when they said/did something. Do your best to listen to their explanation if they give one, then repeat their explanation back to them, telling them that you understand but it was still upsetting. Ideally you'll get an apology, but the main thing is to let yourself feel like you've dealt with the problem.
Of course, in some cases you can't make yourself feel all better that way, or there are situations where you can't face the cause of what's upsetting you directly. In those cases, there are ways to regulate your emotions without penting them up. If you're feeling angry, go for a run or excercise in some way. Rage is great fuel for physical activity, and afterwards you're too tired to be as mad as you were. If you're sad, set aside some time for you to have a good cry. It releases stress when you do. After that, wash your face and go do something fun. These are healthy ways to release built up stress and emotions. Don't let it go more than a day if possible.
If you can't get time alone to deal with your emotions, which often you can't, how open you are with your emotions should be determined by who you're with. With friends, your shouldn't rant about what happened but you can tell them that you're upset and let them try to cheer you up. Make sure to thank them if they do this. If you're at work or around strangers, you can hide it a little, but don't let your emotions go unaddressed all day. Essentially, avoid going overboard and getting into the habit of not regulating emotions in a healthy way.
Explanation: