As you write more and more code inside main()
, you'll notice that it becomes increasingly cluttered and messy.
And the more code you write, the more unreadable that it becomes.
A function is a grouping of code, it performs a task, and obviously it's reusable.
Some functions rely on parameters to perform their task.
Some functions will return a final value.
Instead of writing all of your code inside of a single code block,
you can split it up into functions and call them as needed.
Let's begin organizing your code using functions!