Introduction
Functions help keep your code neat and easy to understand. They let you reuse code without writing it again.
When you want to repeat a task multiple times in your program.
When your code is getting long and hard to read.
When you want to separate different parts of your program for clarity.
When you want to test small parts of your code separately.
When you want to make your program easier to fix or change later.