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.
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.
Source : Link , Question Author : iensen , Answer Author : WendiKidd