About 24,000,000 results
Open links in new tab
  1. Kotlin extension function - GeeksforGeeks

    Jan 3, 2022 · To add an extension function to a class, define a new function appended to the classname as shown in the following example: Output: Explanation: Here, a new function is …

  2. Functions | Kotlin Documentation - Kotlin Programming Language

    May 7, 2025 · Kotlin supports local functions, which are functions inside other functions: fun dfs(graph: Graph) { fun dfs(current: Vertex, visited: MutableSet<Vertex>) { if …

  3. How to add an item to a list in Kotlin? - Stack Overflow

    Apr 30, 2020 · A simple answer, you can't directly add items to List without converting it to its mutable form. Talking about an idiomatic approach... 🙄. When you can get away with only using …

  4. Kotlin Functions - W3Schools

    To create your own function, use the fun keyword, and write the name of the function, followed by parantheses (): Create a function named "myFunction" that should output some text: fun …

  5. Extension Functions in Kotlin | Baeldung on Kotlin

    Apr 20, 2024 · Let’s take advantage of apply () to chain related calls: add("Java") add("Kotlin") add("Groovy") add("Python") remove("Python") Notice how our code becomes more concise …

  6. Kotlin Extension Functions: Add Functionality Without Modifying …

    May 16, 2025 · First off: how do we create a Kotlin function? In Java, if you want to add a new function to an existing class (such as String or List), you typically extend the class through …

  7. How to Add New Functions to Existing Classes in Kotlin

    Dec 5, 2024 · In programming, there often arises the need to enhance existing classes by adding new functions. Kotlin, a modern programming language, provides a robust feature called …

  8. Create and use functions in Kotlin | Android Developers

    In the programs you've written so far, you've seen two functions: a main() function, which is required in every Kotlin program. It is the entry point, or starting point, of the program. a …

  9. Kotlin Function (With Example) - Programiz

    How to create a user-defined function in Kotlin? Before you can use (call) a function, you need to define it. Here's how you can define a function in Kotlin: // function body. To define a function …

  10. Kotlin Extension Functions: A Powerful Tool for Code Reuse

    Jan 16, 2025 · Kotlin’s Extension Functions are a powerful tool for code reuse, allowing developers to add functionality to existing classes without modifying their source code. This …

  11. Some results have been removed
Refresh