What does it mean when it says "Rib 2 tog?

Hi I am a new knitter and I am doing a knit 2 purl 2 rib at the bottom of a cardigan The pattern says rib 7, rib 2 tog (rib 8 then rib 2 tog) 7 times. So do I knit them together or purl them together? Sometimes I’m halfway through the knit rib and sometimes halfway through the purl! I tried doing whatever the next stitch was, but it didn’t look nice! Help!

It depends on whether you’re at a purl st or knit st in the pattern at that point and which will keep in it pattern better. You don’t want it to appear like 3 k sts in a row if that’s where you are, so you’d ptog.