Core Concept3 min read
Learn how to use keyword arguments (kwargs) in kScript v2 for clear, readable, and maintainable function calls with named parameters.
Overview
Keyword arguments (kwargs) allow you to pass parameters to functions by name rather than position. This makes function calls more readable, reduces errors, and allows for flexible parameter ordering.| Feature | Benefit |
|---|---|
| All Function Support | Every function accepts kwargs |
| Any Parameter Order | Parameters can be in any order |
| Self Documenting | Code explains itself |
Basic Syntax
Use theparameterName=value syntax to pass arguments by name. You can mix positional and keyword arguments, but positional arguments must come first.
Benefits
- Self-Documenting - Parameter names make function calls self-explanatory
- Flexible Order - Parameters can be specified in any order
- Selective Parameters - Easily specify only the parameters you need