There are reasons why you should be quiet and not fool around in the hallway. The most obvious is to keep from getting in trouble. But there are other reasons. One is the teacher may tell you something while you are in the hallway. Or the principal may make an announcement over the intercom concerning you. True, your teacher may come out to tell you, but there is a chance that she may think that you heard it, because of which you will have completely missed it.
So, to avoid these situations, you should be quiet. A good way to do this is to face forward while in line and stay in a single file line. If the person in front of you turns around and starts talking to you, look down and do not pay attention to them. This should discourage them and the probably will stop.
It is equally important to behave, be quiet, and pay attention in the classroom. Many of the reasons listed in the previous paragraph also apply here. Also, if you do not pay attention in the classroom, you may miss a very important assignment, which, if you miss, could really hurt your grade.
To keep this from happening, there are a few simple things for you to do. One is, as in the hallway, to face forward or whereever your teacher goes. You should leave all unnecessary items off your desk, and keep just the things you need on it. And, if someone starts talking to you, just ignore them.
And last, but definitely not least, you should never talk back to your teacher. This will get you in very serious trouble. Sometimes, if you are in a very bad mood, it may be very hard to keep from doing this. But try to control yourself.
If you follow everything that I have said, you should be pretty much behaved and stay out of trouble.