How to pass one variable into another in JMeter?

This is a common scenario in JMeter to pass the value of one variable into another. Such scenarios are scripted with the help of Nested Variable Function.