Sometimes you just need a break. And it's OK to take a break, but it's good to consider a few things first.
1. Have you been productive?
When you're working hard on something, it's good to give your brain a short break every once in a while. But if you haven't accomplished anything yet, you probably shouldn't take a break before you've even started working! Try setting a reasonable goal and telling yourself to take a break when that's accomplished. For example, you can text your friend after you finish this chapter.
2. Are you in the middle of a good brainstorm?
If you've been "on a roll," sometimes it's better to stick it out and finish the thought, be it the math problems you're working on or the paragraph you're writing. If you're in the groove, groove, baby! :) It is easier to stay in the zone and finish it then it is to take a break and then try and get back into the zone.
3. Are you in a time crunch?
In those times when the deadline is fast approaching, sometimes a bathroom break is all you can afford. And that's OK. The satisfaction of having completed an assignment on time will make the temporary discomfort of powering through the assignment well worth it.
4. Can you take a break from one thing and be productive in another?
I know that doesn't sound like much of a break, but something I've enjoyed is taking a break from working on the computer and taking a textbook outside to read. This helps me disengage from whatever I need a break from, and I can more fully relax when I know I'm still accomplishing something that needs done.
I hope this helps you take breaks wisely and productively!