Sorry if this is wrong place to ask this. Im am new here.

Ive been studying gcode for a while and im about to write my first program. What I need to do is mill a half inch slot in 4 seperate places. The material is quarter inch thick. I was thinking .010 to .020 deep per pass. What I need help with is condensing the code. Is there a way to condense each pass for milling the slot or do I have to write out each pass? Also how do I condense the code for the other three slots? Since its the same pattern can I use a subprogram or subroutine to make the code shorter? How would I do this? Thanks