Repeat function for simple repetition
📖 Scenario: You want to greet your friends multiple times to make them feel special. Instead of writing the greeting many times, you will use Kotlin's repeat function to say hello several times easily.
🎯 Goal: Build a Kotlin program that uses the repeat function to print a greeting message multiple times.
📋 What You'll Learn
Create a variable called
times with the value 3.Use the
repeat function with the variable times to print "Hello, friend!" exactly 3 times.💡 Why This Matters
🌍 Real World
Repeating actions many times is common in apps, like showing notifications or processing lists.
💼 Career
Understanding how to repeat tasks efficiently helps you write cleaner and shorter code in real projects.
Progress0 / 4 steps