Scripts and functions
Put commands in a .m file without a function line to make a script. Add a function line to define a callable function in the same file.
function y = square (x)
y = x .* x;
endfunction
Save on the path, then call square (3) from the prompt. Use path and addpath to manage visibility.