Hi guys ! What is the main purpose of `local func...
# announcements
j
Hi guys ! What is the main purpose of
local function
in Kotlin? ( As far as I know, it is used for reuse common code inside a function )
f
Yep, for code reuse and legibility 😄
👍 1
j
In some case , it will be ambiguity 😞
c
We have prohibited local functions in our codebase, but I sometimes use them during coding - to avoid jumping around the file, and when I'm done I just move them out of the parent function.
m
They're also useful for achieving tail recursion, so it minimizes the scope, and keeps it close to usage point. But in imperative programming, there's little difference.
c
interesting point.