-1

I'd like to know if writing the name of the variable is necessary. Could we just write the variable name (if not variable's name) instead?

Examples:

To reuse data, reuse the name of the variable that stores it.

Scope is the part of the program where a particular identifier, such as a variable or a function name is accessible.

It can lead to conflicting names of the variables.

  • Please do not ask multiple questions within one question, it causes confusion. – Max Williams Feb 12 '18 at 12:03
  • 1
    Hello and welcome to EL&U, which aspires to be a repository of on-topic questions and expert answers about English. We like questions to be well-researched beforehand, with the research posted with the question so that others don't have to waste time looking for things the asker already knows. To facilitate the scoring process (up/down votes), we also like questions to be focused (ask about 1 thing per question). Here's an answer I posted that's relevant to your Q2. If it addresses your query, consider dropping Q2 and expanding on Q1. – Lawrence Feb 12 '18 at 13:32
  • Hi Aduku. Can you give an example of a sentence, please? "The variable name" is OK in many cases, but sometimes it is grammatically better to say "the variable's name". – ArchContrarian Feb 16 '18 at 22:07
0

It depends heavily on the context.

To explain:

To reuse data, reuse the name of the variable that stores it.

This is correct because we're talking about the name (a property) of the "variable that stores the data".

To reuse data, reuse the variable's name that stores it.

This is incorrect because now we're saying its the name (that belongs to the variable) storing the data.

To reuse data, reuse the variable name that stores it.

This is incorrect because we're still saying the variable name (as a thing) stores the data.

Scope is the part of the program where a particular identifier, such as a variable or a function name is accessible.

This is correct because we're saying the function name (as a thing) is accessible.

Scope is the part of the program where a particular identifier, such as a variable or a function's name is accessible.

This is correct, and is basically identical to the sentence above. We're saying the name (that belongs to a function) is accessible.

It can lead to conflicting names of the variables.

This is grammatically correct but very badly written. We're saying there are "conflicting names" that are properties of the "variables", but this makes it sound like all variables have names that are conflicting.

It can lead to conflicting variable names.

This is correct and makes much more sense than the sentence above. Now, it is clear that we are talking about the variable names (as things) conflicting with each other.

Source: Native speaker & author. Hobbyist coder.



EDIT: Detailed answer to an example from the comments:

The book's title is confusing when compared to the content of the book.

This is correct because we are saying the title (that belongs to the book) is confusing when compared to the content (a property) of the book.

The book's title is confusing when compared to the book's content.

This is correct because we are still saying the title (that belongs to the book) is confusing when compared to the content (that belongs to the book).

These two sentences are very similar. In this context, they mean the same thing.

-------------BONUS TIP---------------

Because we have already explained that we're talking about the title that belongs to the book, we don't need to explain that the content also belongs to the book. Instead, we can use the possessive form of the generic noun "it" and say:

The book's title is confusing when compared to its content.

This is correct because we are saying the title (that belongs to the book) is confusing when compared to the content (that belongs to it). We can assume that "it" = the book because we are not talking about any other objects.

Note: Be careful to not confuse "its" with "it's". "Its" is the possessive form of "it". "It's" is a contraction of "it is".

  • Thanks for your help @Hyperglyph! Hoping that I understood your answer, I tried to rewrite this sentence: The book's title was confusing when compared to the content of the book. / the book's content.. Unfortunately, I'm still not so sure about the last part... – Aduku Feb 20 '18 at 18:11
  • I edited my post with a detailed explanation (at the bottom) of that sentence. I hope it helps. – Hyperglyph Feb 20 '18 at 22:32

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.