Is it possible to concatenate a variable to itself a such?
@varA: "hello ";
@varB: "world";
@varA: "@{varA}@{varB}";
(to output “hello world”)
I am able to do this,
@varA: "hello ";
@varB: "world";
@varC: "@{varA}@{varB}";
But something about using the variable in itself seems to break everything. Is this a LESS bug ?
Just installed less to try it out and indeed, trying it the first way I get
In fact, assigning a variable to itself results in the same error. I have looked around at the source and I can’t say for certain what causes it (although due to the nature of the error, we can guess fairly easily). As far as documentation goes, it mentions that the variables are constants, however after doing some tests, I found that you can in fact define a new variable with the same name as the old one. So:
will actually work, and when you use vA later on, it will have a value of “hello”.
I recommend that you simply use a temporary variable, if you actually find that you need it.
Just keep @tmp around and use it when you want to, as long as you don’t try to define a new @tmp in terms of itself.