Matlab allows two types of program files
Scripts: It is a file with .m extension. In these files, it writes series of command that you want to execute together. It does not accept inputs and do not return any outputs
Functions: They are also files with .m extension. Functions can accept inputs and return outputs.