Why is a Kotlin local function required to be declared before, unlike C#?

It seems that unlike C#, the local function must be declared before using it. Why is it designed so? Why can’t the local function be placed at the end, like C#?

C# ( https://dotnetfiddle.net/gegBvH )


public static void Main() { Say("Hello world"); void Say(string str) { Console.WriteLine(str); } }

Kotlin ( https://pl.kotl.in/difiJRvWP )


fun main() { fun Say(str:String) { println(str) } Say("Hello world"); }

submitted by /u/evolution2015
[link] [comments]