If I understand your question correctly, it is one of the most basic parts of programming.
Therefore I suggest that you take a look at
this[
^] and if necessary go back to the beginning of that tutorial set and start following the examples.
If I have misinterpreted your question, I apologize.