Sometimes it is convenient to have variable variable names. That is, a variable name which can be set and used dynamically.
If, for example, you want to use a HTML-Snippet based on color and type you can define the snippets in advance like this:
$CMS_SET(white_headline, "<h1 style='color: #fff;'>")$
$CMS_SET(white_subline, "<h2 style='color: #fff;'>")$
$CMS_SET(red_headline, "<h1 style='color: #f00;'>")$
$CMS_SET(red_subline, "<h2 style='color: #f00;'>")$
Later on you can then access these snippets by dynamically connecting the content of the variables as set by the editor. Let us assume, that there are two input components named st_color and st_type which are filled with the content "red" and "headline", respectively.
$CMS_SET(snippetToUse)$$CMS_VALUE(st_color)$_$CMS_VALUE(st_type)$$CMS_END_SET$
$CMS_VALUE(#global.getContext().getVariableValue(snippetToUse.toString()))$
In this case the variable red_headline will be assembled so the output of the CMS_VALUE call is:
<h1 style='color: #f00;'>