Call a variable from others in the LESS

2

How can I call a variable from other variables like in other languages in less?

PHP:

$name = 'stack';
$level = '900';

$nameVariable = $name . $level;

${$nameVariable}; // chama variável: $stack900
$$nameVariable; // chamar variável: $stack900
    
asked by anonymous 14.04.2016 / 16:42

1 answer

2

Oops, after trying hard enough!

Less:

@name: stack;
@level: 900;

@nameVariable: ~'@{name}@{level}';

@@nameVariable; // chama variável: @stack900

The reason for using @{name}@{level} instead of @name@level is:

Example:

@{name}@{level} // stack900

@name@level // stack 900

and ~ is to remove the quotation marks ''

    
14.04.2016 / 17:24