Need Coding help

So i’m trying to program an electric vehicle using the button code to start it as well as the code for optical shaft encoders for distance and I don’t know how to combine the two codes to work together, any help?

Put the button code first. Then put the encoder code.