Imagine you've written a really useful piece of code and now you need it in 10 different places in your app. Do you copy and paste it 10 times? What if you need to change it later β€” would you remember to update all 10 copies?

That's exactly the problem functions solve. Write it once, use it everywhere. 🧠

A function is a named chunk of code that you can run whenever and wherever you need it. Instead of repeating the same code over and over, you wrap it up in a function, give it a name, and just call that name whenever you need it.

Here's a simple example β€” a welcome message for an app:

func showWelcome() {