Why functions organize code
📖 Scenario: Imagine you are helping a friend organize their daily tasks. Instead of writing all tasks in one long list, you group similar tasks together. This makes it easier to find and repeat tasks.
🎯 Goal: You will create a simple R program that uses a function to organize and reuse code for greeting people.
📋 What You'll Learn
Create a function called
greet that takes one input called nameInside the function, create a greeting message using the
nameCall the
greet function with different namesPrint the greeting messages
💡 Why This Matters
🌍 Real World
Functions are like little machines that do one job. This helps programmers keep their work neat and easy to fix or change.
💼 Career
Knowing how to write and use functions is a basic skill for any programming job. It helps you build bigger programs step by step.
Progress0 / 4 steps