0

Somewhere in a post there's a code snippet like:

var x = 0;

Then I explain the code, and refer to the variable in my text like so: "When you're declaring x in the global scope ..."

Should I use definitive article before x in these cases, or will the emphasizing replace the article?

1 Answer 1

3

No definite article is needed. The reason is that in defining the variable you are giving it a name. And names don't normally get definite articles.

Consider: Freddie is a hippie. Freddie is fat. You wouldn't say "The Freddie is fat"

The only time definite article often comes into play with names is when the name leaves ambiguity. Eg "Is that the Freddie who owns a cat?"

So you would use "x" or "the variable" to refer to that thing, but not "the x".

There is one place where the usage gets a bit fuzzy. A comment could be made along the lines of "The x in that statement names a variable" The reason you will see that phrasing is because the sentence is not using x as the name of a variable, it is referring to the character in the sentence.

4
  • Thanks for the answer. I knew about a rule that articles are not used in the context of "human" names, but that also applies to any names is new to me. Looks like I've messed up with this site (asked first then logged in), and I can't see the Accept Mark. I'm sorry, it seems that I can't accept your answer (voted up though), or do you have any trick how I could do it?
    – Teemu
    Aug 12, 2015 at 20:57
  • @Teemu: SE's instructions on merging. Aug 13, 2015 at 0:47
  • But shall you use "the variable x" or "variable x"?
    – Ayrat
    Mar 28, 2019 at 20:37
  • 1
    If "x" suffices for clarity it's fine by itself. If it helps clarity you can say "variable x" and of course you might need to if there were a variable and something else like a method. As for the definite article, it's certainly not required, but it's fine to add if it sounds better. I think the issue is that X can be thought of as a name or as a thing. Thus "X marks the spot" and "The x marks the spot" are both correct. (I don't think that occurred to me 4 years ago)
    – elc
    Mar 29, 2019 at 21:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .