In short: do as many different things as you can.
Now a slightly longer explanation.
Of course I don't mean to just rush from one thing to the other, never quite learning anything. Of course take your time to familiarise yourself with the tools you're working with, the environment, and so on. But if you're feeling you're already up to speed and comfortable, and an opportunity arises to do something in a new language (for example), and it's okay that you haven't got any experience in it yet, go for it. (Never lie about your experience, leave that sort of stuff to management consultants. :))
What I also don't mean is to never stop doing this. This kind of strategy is fine when you're starting out, and some people stay like that forever, but most eventually will settle for one thing and go very deep in it. But even they will benefit from knowledge of other languages, paradigms or indeed roles.
And of course the usual caveat: this isn't a recipe for success (indeed it's not about success at all, more like feeling your life is worthwhile), just a heuristic that is based on a tiny sample I've personally witnessed, and for added bias, I fall into that sample too.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.