Functions • Lesson 34/100+50 XP

Default Parameters

Parameters with default values

📚
Learn
💻
Code
Quiz
🏆
Practice
Complete

📚 Lý thuyết

**Default Parameters** cho phép bỏ qua arguments khi gọi function. **Cú pháp:** ```kotlin fun greet(name: String = "World") { println("Hello, $name!") } ``` **Quy tắc:** - Default params nên đặt cuối - Có thể mix với non-default - Giảm số lượng overloads cần thiết