This chapter shows how to write subroutines and functions and discusses their differences and similarities.