Loose stitches when ribbing

I am a beginner, and I though I could handle a simple ribbed scarf, with k2p2. However I am getting very loose stitches at the end of the each row and the edges just look awful. I am not sure what I am doing wrong and also I am not sure which cast on/cast off method to use. Can I anyone help me?

The loose edges of a scarf can be helped by slipping the first stitch of every row and knitting the last stitch of every row. This tightens up the edges.

I find the long-tail cast on to be the most even. What kind did you use?

I also used long tail cast on so I shall stick with that if you think it is suitable too! For fear of sounding silly, if I slip the first stitch of every row won’t the scarf get narrower, and also if the last two stitches are purl stitches, then is it ok if i purl one then knit one? Will that not affect the ribbing pattern?

It won’t get narrower, because you’re knitting that stitch at the end of the next row. Slipping the first stitch just allows it to be knit every other row, making it tighter.

If you plan on starting over, you can add an extra stitch to each edge for your ‘selvedge’ stitches and keep the ribbing between them. If you plan to continue, and have already started with two purls at the end, you can purl the last stitch, or it will be obvious that there was a change. As it is, if you start slipping now, there will be a difference, anyway.