Say I have a program that swaps two variables:
1)read a 2)read b 3)buf=a 4)a=b 5)b=buf 6)print a 7)print b
I want to say that I swap the values of a and b on (or should it be at or in?) lines 3-5 of the program.
English Language Learners Stack Exchange is a question and answer site for speakers of other languages learning English. It only takes a minute to sign up.Sign up to join this community
I would definitely use on here. On is the preposition we tend to use when referring to written things in these contexts. For example:
Open your books and read the text on page 27.
On this page, read the sentence on line 5.
This carries over to your situation:
The values are swapped on lines 3-5.
The code appears on those lines. If you were referring to the actual execution of the program instead of the written text of it, you might instead say something like
The values are swapped when lines 3-5 are executed.
But I think swapped on works just fine.
It depends what you really mean. As a programmer myself, I see you're doing the temp swap. So the correct coding answer would be:
Swap the values at lines 3 - 5
Better would be:
Swap the value a with b, as shown on lines 3 through 5.
This is the same as
Swap the values (like they are shown) at lines 3 through 5.