5

I am trying to document some code and this sentence sounds confusing.

Replaces the existing item associated with the provided key with newItem.

I am tempted to put a comma here but I am not sure if it would be correct.

Replaces the existing item associated with the provided key, with newItem.

If it's incorrect, how can I state my intention clearly?

1
  • 1
    Having the worth "with" twice is your problem. Commented Sep 27, 2012 at 4:20

2 Answers 2

5

I would write:

Replaces the existing item, which is associated with the provided key, with newItem

Replaces the existing item, associated with the provided key, with newItem.

And if the key is something that's common between the two items, then you could say something like this:

[With the provided key it] replaces the existing item with newItem.

Or

Replaces the existing item with newItem based on the provided key.

3
  • I like your Option 2, and the O.P. may even want to consider using dashes: Replaces the existing item – associated with the provided key – with newItem.
    – J.R.
    Commented Sep 16, 2012 at 12:15
  • @J.R. Yea, I think that sounds better.
    – Noah
    Commented Sep 16, 2012 at 12:35
  • +1 I think this is what it is. Though rephrasing would be definitely better.
    – Kris
    Commented Sep 16, 2012 at 13:14
4

I think you may have been looking at it too long. I see what you mean, but a comma doesn't add anything. My suggestion is to either simply italicize newItem as in:

Replaces the existing item associated with the provided key with newItem.

or change it to something like:

Replaces the provided key's currently associated item with newItem.

2
  • NB: You don't need a hyphen between currently and associated. You're linking an adverb with an adjective, not two adjectives to a noun. The adverb modifies the adjective, not the noun.
    – Robusto
    Commented Sep 16, 2012 at 12:25
  • @Robusto removed. Commented Sep 16, 2012 at 12:48

You must log in to answer this question.