Can I simply use the same switch loop technique as with a light?

![switch loop](https://i.stack.imgur.com/83Y4q.jpg)

in combination with this:

![enter image description here](https://i.stack.imgur.com/uUUU8.jpg)

replacing the light with the final outlet?