Why is `return` not allowed in Kotlin init block?

Viewed 7091

If I compile this:

class CsvFile(pathToFile : String)
{
    init 
    {
        if (!File(pathToFile).exists())
            return
        // Do something useful here
    }
}

I get an error:

Error:(18, 13) Kotlin: 'return' is not allowed here

I don't want to argue with the compiler, but I am curious about the motivation behind this restriction.

1 Answers
Related