Suppose the following assignment:


I know that the common phrase is:

20 is assigned to X

How can I say the sentence in reverse order, to begin with X?

  • Have you looked it up in a dictionary? – userr2684291 Jan 17 '17 at 13:50
  • @user26 yes, but its example wasn't about a variable and a value. Also check my modification. – Ahmad Jan 17 '17 at 13:54
  • I would suggest that you try to understand the definition instead. – userr2684291 Jan 17 '17 at 13:58
  • @user26 I read that and I guess the first one is correct but my question is different. Please read my question and don't repeat general advice. – Ahmad Jan 17 '17 at 14:01
  • @user26 but all are not agee that both are correct. Also I asked several related questions. Check them again. – Ahmad Jan 17 '17 at 14:10

I suppose either is correct depending on context.

If you were defining a math problem for example, 5 + 6 = 11 to make this equation a math problem I would assign one of the values a variable. 5 = x, therefore x + 6 = 11 making it a problem.

Vice versa..

In order to solve the equation I would assign the variable a value, x = 5 by progress of elimination to figure out the correct value of the variable.


Given your two choices

  • Assigning a value to a variable
  • Assigning a variable to a value

I'd find the first one easier to understand.

Let's take computer programming as the example. In some programming languages, "=" is the "assignment operator". $a = 5; I can read this as "$a becomes equal to 5" or "let $a be(come) equal to 5" or "Assign the value 5 to the variable $a".

In this context, nothing can be "assigned to" a value. I could make a grammatical argument that second just means the same as the first, but it just strikes me as a common accidental reversal.

Edit after OP's Major edit: Borrowing from user2684291 You could say "Assigning X 20".

Or perhaps in a sentence fragment By assigning X 20, we can calculate...

  • I want to use the variable first, maybe "setting $a to 5" but I also thought "assigning $a with 5" works. does it work? – Ahmad Jan 17 '17 at 14:36
  • Check my own answer too. – Ahmad Jan 17 '17 at 14:43
  • Yes, setting $a to 5 is fine. "Here we set $pi to 3.14 so that we can..." – TecBrat Jan 17 '17 at 15:01
  • Here's another NGram to show the popularity of the two phrases: books.google.com/ngrams/… – TecBrat Jan 17 '17 at 15:10
  • A major edit to the OP question has left my answer seeming a little strange, but still relevant. – TecBrat Jan 17 '17 at 15:16

Depends. Imagine that a value is a number. And variable is the thing which declares the number. Math example:

a=15; a=variable. 15 is a value of "a" variable.

  • You didn't say how it depends. – Ahmad Jan 17 '17 at 13:48

In the example:

X = 20

20 is assigned to X.

If you want to change the order you can say:

X is set to 20

If you want to use the same assign verb, you can say:

X is assigned the value 20.

  • 1
    Google NGram does not support this books.google.com/ngrams/… , (Greater than zero support, but not much greater than zero.) – TecBrat Jan 17 '17 at 14:52
  • This isn't the only interpretation, since the OP doesn't know what assignment means. Please provide more context. – userr2684291 Jan 17 '17 at 14:56
  • 2
    You can say: "the value is assigned to the variable" or "the variable is assigned the value" with no difference in meaning (or the reversal of the assignment operator; assuming variable = value to mean variable <- value). – userr2684291 Jan 17 '17 at 15:15
  • 1
    I didn't. That would convey a slightly different (and the opposite) meaning. – userr2684291 Jan 17 '17 at 15:18
  • 1
    @user2684291 Then what I was looking for is "the variable is assigned the value" without "with". right? thank you! – Ahmad Jan 17 '17 at 15:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.