List of Kotlin live templates
Use live templates to insert common constructs into your code, such as loops, conditions, declarations, or print statements.
This table summarizes the live templates that you can use with your Kotlin code.
Abbreviation | Description | Template text | Can be applied in |
---|---|---|---|
| Anonymous class |
| Kotlin statement Kotlin expression |
| Closure (function without name) |
| Kotlin statement Kotlin expression |
| Extension function |
| Kotlin class Kotlin top-level |
| Extension read-only property |
| Kotlin class Kotlin top-level |
| Extension read-write property |
| Kotlin class Kotlin top-level |
| Function with no parameters |
| Kotlin statement Kotlin class Kotlin top-level |
| Function with one parameter |
| Kotlin statement Kotlin class Kotlin top-level |
| Function with two parameters |
| Kotlin statement Kotlin class Kotlin top-level |
| Inserts 'if null' expression |
| Kotlin expression |
| Inserts 'if not null' expression |
| Kotlin expression |
| Interface |
| Kotlin statement Kotlin class Kotlin top-level |
| Iterate over elements of iterable (for-in loop) |
| Kotlin statement |
| main() function |
| Kotlin top-level |
| main(args) function |
| Kotlin top-level |
| main(args) function |
| Kotlin object declaration |
| Anonymous class |
| Kotlin statement Kotlin expression |
| main() function |
| Kotlin top-level |
| main(args) function |
| Kotlin top-level |
| main(args) function |
| Kotlin object declaration |
| Prints a string to System.err |
| Kotlin statement |
| Singleton |
| Kotlin statement Kotlin class Kotlin top-level |
| Prints a string to System.out |
| Kotlin statement |
| Prints current class and function name to System.out |
| Kotlin statement |
| Prints method parameter names and values to System.out |
| Kotlin statement |
| Prints a value to System.out |
| Kotlin statement |
| Function returning nothing |
| Kotlin statement Kotlin class Kotlin top-level |
Thanks for your feedback!