0

I wrote:

Unlike global variables, if there is already a local variable in the list, with the same name of as a new variable, the old variable isn’t replaced.

I thought maybe the distance between "with the same name..." is long. So, I wrote:

Unlike global variables, if a local variable with the same name of as a new variable already exists in the list, the old variable isn’t replaced.

Are both sentences equivalent? Which is more fluent?

  • A note on the phrase "same name of" -- as is a more idiomatic preposition than of here. "The same as" is a common phrase. "I went to the same school as you," "She has the same name as her grandmother," "The weather is the same as it was last week." You can compare ngrams on "same name as" and "same name of." – cbh Oct 6 '16 at 16:59
  • Actually, both of them read pretty well to me. The second one is slightly clearer, I think, because "with the same name" is closer to the thing it applies to, as you point out. – stangdon Oct 6 '16 at 18:23
  • 1
    "Unlike global variables, if a local variable has the same name as an existing variable, the existing variable isn’t replaced." You need to be careful since even though the existing variable is not replaced, usually the scope of the new variable will effect how both get used. – Peter Oct 6 '16 at 18:26

Your Answer

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

Browse other questions tagged or ask your own question.