Hahaha, why not just check if the toothpaste you're grabbing is the last one?
Still I think this is a stretched analogy. Decent strategy in real life, but programming is not the same and in my experience in-band signalling like this generally leads to fragile code. I mean nobody would recommend null terminated strings as a sane design today...