Sunday, April 14, 2019

phrases - "Assign a variable to a value" or the other way round?



I was wondering which of these phrases is/are correct:





  • assign a variable to a value

  • assign a value to a variable



I'd say the second is correct, but I'm not a native speaker. A quick Google search reveals thousands of results such as "assign a variable to the file content", but another search returns a lot of results for the other word order ("assign a value to HTML input field").



Which of these two phrases is correct? Or are both correct?


Answer



Assign a value to a variable is correct. Alternatively, you could say assign a variable a value.




Compare assign and give:




Give a value to a variable vs. give a variable a value



No comments:

Post a Comment