Defining variables with a variable name?
See original GitHub issueAll of LESS documentation is pretty straightforward except for this:
@fnord: "I am fnord.";
@var: 'fnord';
content: @@var;
This apparently compiles to:
content: "I am fnord.";
The example is extremely confusing because of the 3 references to the word ‘fnord’. Just what is referencing what? Can this example be rewritten with less ambiguous naming? It looks like a promising feature, but I’ve never used it because I never understood what this piece meant.
Issue Analytics
- State:
- Created 12 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Using a string variable as a variable name - Stack Overflow
I have a variable with a string assigned to it and I want to define a new variable based on that string. foo...
Read more >Variables in C - GeeksforGeeks
A variable in C is a memory location associated with some name in order to store some form of data and retrieve it...
Read more >C Variables, Constants and Literals - Programiz
Rules for naming a variable · A variable name can only have letters (both uppercase and lowercase letters), digits and underscore. · The...
Read more >Variables - The Modern JavaScript Tutorial
A variable is a “named storage” for data. We can use variables to store goodies, visitors, and other data. To create a variable...
Read more >C# Variables: Declare, Access & Use ... - TutorialsTeacher
Above, int is a data type, num is a variable name (identifier). The = operator is used to assign a value to a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
You cannot use
+
for strings, but you can do this:Sorry for late reply.
In theory yes. It evaluates the first variable first and then evaluates that as a variable.
What you are trying to do in your example above is concatenate two variables which the LESS language doesn’t support as far as I’m aware. You may be able to use the + operator to join strings though (not tested (or researched)):