I am trying to wrap my head around how programming languages work. Sometimes I come across things that stump me. I was wondering if anyone can explain how the code below works.
This is from http://lesscss.org/#docs
It is also possible to define variables with a variable name:
@fnord: "I am fnord.";
@var: 'fnord';
content: @@var;
Which compiles to:
content: "I am fnord.";
In my untrained mind @@var would equal “fnord fnord” or “I am fnord. fnord”
Please can anyone explain how content is equal to “I am fnord” Thanks
when parsing @@var, you evaluate @var first, it gives you fnord, then @@var continues to be evaluated as @fnord and @fnord value is “I am fnord.”. It’s kinda dirty to allow that as a programming language, but PHP does for example…