The basic idea is that white goes back and forth from one
edge of the scarf and black from the other.
In the above picture the time has come to insert a black key. How does this work? First knit 10 stitches from the white edge.
With a third needle knit the remaining 20 stitches from the black edge. Note that since this knitting is from the opposite edge it is really purling from the perspective of the first 10 stitches. This will give a ribbing effect.
Crossing the white under the black to intertwine them, knit 10 stitches back to the white edge.
Here is what it looks like after 3 stitches. Note the intertwined black.
And after 10:
Now 20 black stitches. We are back to the state we were in when we started - each color at its own edge.
Repeat all of the above once more to get:
We are done knitting with the black yarn for this key. Next knit 10 stitches from the white edge.
To make a clean upper edge for the black key, continue with white towards the black edge but use a purl stitch, not a knit. Here is the first stitch:
When nearing the black edge with the purled white stitches the black stitches will become quite loose. Snug them up after you finish with the row.
Voila! We now have a black key within the white scarf. Continue knitting with white until the time comes again for the next black key.
Whenever you are at the black edge with the white yarn be sure to cross the white under the black before proceeding back to the white edge. This way the black yarn will be carried along the edge and will be ready when it is next needed. This does make for “crossings”, but, since they are on the edge, it is visually more acceptable.