When knitting with two or more colors, there exists the ever-present conundrum of what to do with the yarn you aren't currently working with. One popular technique is known as the Armenian knitting technique (though its connections to Armenia are hard to discern). The Armenian knitting technique tacks the non-working yarn to the piece regularly to limit floats. You will tack your non-working yarn down approximately every 3 stitches.
For simplicity's sake, let's say you're working a group of stitches in your main color and now want to tack your contrast color yarn. To tack your yarn using the Armenian technique, you will place your right hand needle in your next stitch to begin the knit. Next, wrap your contrast color yarn. This is the tricky part because if you don't wrap this yarn right, it won't cross with your main color yarn and no tack will happen.
First, make sure your contrast color yarn goes underneath your main color yarn. Then wrap your contrast color yarn around your right hand needle from the top down, opposite from how you wrap yarn to knit. Next, wrap your main color yarn as you normally would to knit. Finally, remove your contrast color yarn from the right hand needle and complete the knit stitch.
Once you get the hang of it, this will make sense and can go quickly.
The Armenian knitting technique can also be worked on the purl side of your work. On this side, the trick again is to make sure that you're crossing the contrast color yarn with the main color yarn before beginning to wrap your yarns around the right hand needle.
Why use the Armenian knitting technique instead of simply wrapping the yarn to control floats? This technique seems to create a more secure tack of the non-working yarn. The wrong side of the knitting looks cleaner. But there's one other trick to this technique and a big reason for using it: you don't just tack the contrast color yarn on rows where you use that color. You continue tacking the yarn throughout the body of the work, even the parts that are exclusively knitted with the main color. A lot of projects using the Armenian knitting technique have one small color feature, say a flower on one corner of a sweater. But the yarn for that one color feature continues to be carried on the back side for the entire body of the work. Doing this adds depth and interest to the main color as little hints of the contrast color comes through. It also creates a beautiful back side, which can be especially pleasing if you're making something like a cardigan, where the back side will occasionally be seen.
Keep in mind as happens any time you work with two balls of yarn, your yarns will become twisted and you will have to unwind them from each other every few rows.