Forgive me for such a basic question; this is (I suppose) more of an English question than a programming question; but I think as software developers we make such statements on a fairly regular basis.
If I have this code:
int x = 0;
…does the above “assign x to 0“, or does it “assign 0 to x“?
It’s just been bugging me. Feel free to close if you know of a better place to be asking (though if someone provides a cogent answer before this question is closed, I will be happy).
Edit: The nice thing about the above code is that if I’m talking about it, I could really phrase it either way and it should be clear what I mean to any thinking human being (as 0 is not a variable). I just know I sometimes hit a mental wall when I try to explain a line like this:
x = y;
If I say “it assigns y to x“, I’m saying something that (surely) means the opposite of what I’d be saying if I said “it assigns x to y“; yet both seem reasonable!
Oh well…
Webster.com should be pretty authoritative: For the verb “to assign”, they specifically give the example “assign a value to the variable” (and, for what it’s worth, that’s the way I’ve always heard the term used). In your example, you would assign the value 0 to the variable x.