Skip to main content
10 events
when toggle format what by license comment
Oct 1, 2021 at 17:18 comment added David Schwartz @Maggyero You've never heard someone say something like, "The program will need to keep track of the sum of the inputs, so you should assign a variable to hold the sum." Here is one example.
Sep 28, 2021 at 21:05 comment added Géry Ogam ‘It means to designate a specific variable to hold a certain value.’ I have never seen ‘to assign’ used as a synonym for ’to designate’. Could you provide a reference of that usage?
Sep 28, 2021 at 19:53 comment added David Schwartz @Maggyero "When you assign a variable, you replace the content of an already allocated storage location ..." No, that is not true. A computer does not do anything just because a human assigns a variable to something. Variables can be assigned even in contexts where there are no storage locations. Again, assigning a variable to something is something a human does. Computers assign things to variables because computers can manipulate variables but not general things. Humans assign variables to general things because humans manipulate things. Please actually read my answer.
Sep 28, 2021 at 11:22 comment added Géry Ogam ‘I will assign the variable sum to hold the sum.’ You are confusing assignment with declaration. When you declare a variable, you bind a name to a newly allocated storage location, which updates the environment (binding) and the store (allocation). When you assign a variable, you replace the content of an already allocated storage location with a new value, which updates the store.
Sep 27, 2021 at 16:37 comment added David Schwartz @Maggyero I'm not describing storage allocation. I'm describing value assignment. As in, "I will assign the variable sum to hold the sum." It's something a human does, as I clearly state, not something a computer does. Did you miss the part about it being "something you do"? Computers don't assign variables to values, humans do. Computers assign values to variables.
Sep 27, 2021 at 7:38 comment added Géry Ogam ‘After you have done this, you intend that the variable will hold that value, but it doesn't actually hold it yet.’ You are describing storage allocation here, not value assignment.
Sep 27, 2021 at 1:39 comment added David Schwartz @Maggyero Can you be precise about where you think I'm doing that? I've read my answer over a few times and can't see where you think the confusion is.
Sep 25, 2021 at 20:20 comment added Géry Ogam -1 You are confusing declaration and assignment as @user39420 said.
Mar 13, 2013 at 8:12 comment added user39420 When a variable isn't assigned a value, it's actually said to be just declared. A variable declaration and assignment can be (and often is) done in a single statement: var color = "green"; However, the declaration can be done in one statement: var color; and the assignment in another: color = "green"; (Of course, the assignment must follow the declaration and not precede it.) My point is that variable declarations and variable assignments are not the same thing.
Dec 12, 2011 at 5:47 history answered David Schwartz CC BY-SA 3.0