Can I use a variable to name other variables?

Let’s find an answer to "Can I use a variable to name other variables?". The most accurate or helpful solution is served by Stack Overflow.

There are ten answers to this question.

Best solution

Can you use variables in a variable name in Javascript?

var array1 = new Array(4); var array2 = new Array(4); var array3 = new Array(4); var array4 = new Array(4); var array5 = new Array(4); var array6 = new Array(4); var array7 = new Array(4); for(var a = 1; a < 8; a++){ array+ a = new Array(4); } I want to make an array with a for loop, but the variables has to be diffrent every time. So my question if this is possible, and if it is, how?

Answer:

No you can't (not unless you use Eval() which you shouldn't...). As Justinas has commented, you could...

Read more

Twan Korthout at Stack Overflow Mark as irrelevant Undo

Other solutions

Answer:

psh, why use string stream? string a = " your info 12234" ; string name , temp_string ; int...

Read more

Eric at Yahoo! Answers Mark as irrelevant Undo

Answer:

Using the same name for two different variables in languages like C is possible only within two different...

Read more

wiki.answers.com Mark as irrelevant Undo

Answer:

I personally avoid underscores, it's kind of ... You must be signed in to read this answer.Continue...

Read more

Anonymous at Quora Mark as irrelevant Undo

MATLAB: How can I use regular expressions to collect a list of variable names that satisfy a particular pattern?

I have a set of variables in my workspace. I want to use regular expressions regexp to get the name of the variable names that match a particular pattern.

Answer:

Building on another answer: % Gets variables from current workspace. listOfVarNames = whos; % Use strfind...

Read more

Prabhakar Govind at Quora Mark as irrelevant Undo

Delphi 7 - variable in an object name?

I am looking for a way to make my objects follow each oder (each follows the previous one) in delphi 7. But I don't know how to use variables as the name of an object. to make all things clear: my objects names are s1,s2,s3 and so on "int"...

Answer:

I would suggest you use an array of TObject (Generic) or typed objects if all your objects are the same...

Read more

Adam at Yahoo! Answers Mark as irrelevant Undo

How do you decide what to name variables (in writing, not programming)?

As an experienced programmer, I wouldn't think twice about giving a variable representing profits the name "profits."  But I am writing a paper that is long on economics, sociology, and political science.  And written papers, in my experience...

Answer:

Social science variables aren't always represented by their first letter. In economics, income is typically...

Read more

Matt Ford at Quora Mark as irrelevant Undo

How does one access Django template variables in JavaScript?

I am using Django/jQuery to render my web pages for my project. I have a particular predicament that I have not been able to resolve. I hope that some one may be able to help. <b>Set up:</b> I use jQuery on ready function to invoke Google...

Answer:

Declare a js variable in a script tag within HTML and directly use in external js files.<script...

Read more

Gagan Khanijau at Quora Mark as irrelevant Undo

Java static variables problems...?

Create a class named Household that includes data fields for the household name, number of occupants and the total monthly household income. In your class, include the following methods: A method to calculate and return the average income per occupant...

Answer:

First of all , yes ! your average calculation is perfect :) and revised every year means that your data...

Read more

Siaw at Yahoo! Answers Mark as irrelevant Undo

What should I do given all these variables (home mortgage edition)

I'm getting married! And buying a house with my fiance! And I'm so, so confused about the best plan (longish question, totally special snowflake focus). So, my sweet, sweet guy is selling his very nice townhouse that he only bought a year ago so we can...

Answer:

Why not continue to rent in the good school district for two years and then buy? You can presumably...

Read more

Lizlemondrop at Ask.Metafilter.Com Mark as irrelevant Undo

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.