If one subprogram needs to use data stored in another subprogram, what’s the solution? The easiest and most dangerous solution is to let multiple subprograms access that variable as a global or module variable. The better solution is to isolate that variable as a subprogram variable and then share or pass that data to another subprogram.
This means you have to declare two subprograms variables, one in each subprogram. Although cumbersome now you know why programs create global or module variables instead, passing data from one variable to another, dubbed parameter passing, helps keeps the data isolated in only the subprograms that actually need to use that data.
First, you may need to specify the filename that contains the subprogram you want to use. Second, you need to call the subprogram you want by name. Calling that subprogram from another part of your program would always print the name John Smith exactly five times. If you wanted a subprogram that could print the name Mary Jones 16 times, you’d have to write another similar subprogram. Obviously, writing similar subprograms that do nearly identical tasks is wasteful and time-consuming to write. So as a better alternative, you can write a generic subprogram that accepts additional data, called parameters.