Switch case question / lost in terminology

If I did not misunderstand, what he wants is a memory of last value. And I think the input is random, it does not seem viable nth-input, but it not is clear what the input of the selector value is.