Functions are used to keep the code orderly. They are unrelated to a portfolio loop.