Calling a variable from other variables in LESS

Asked

Viewed 44 times

2

How can I call a variable from other variables as in other languages in Less?

PHP:

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

$nameVariable = $name . $level;

${$nameVariable}; // chama variável: $stack900
$$nameVariable; // chamar variável: $stack900

1 answer

2


Oops, after trying hard I got!!!

Less:

@name: stack;
@level: 900;

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

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

Why to use @{name}@{level} instead of @name@level is:

Example:

@{name}@{level} // stack900

@name@level // stack 900

and the ~is to remove the quotes ' '

Browser other questions tagged

You are not signed in. Login or sign up in order to post.