Kotlin requires that all properties be initialized by the time that the init block ends (with one exception, lateinit, that we will next).

Any property that is initialized in the init block, though, does not also need to be initialized at the point of declaration. Here, count is not initialized where it is declared, but it is initialized in the init block, so this is fine.

You can learn more about this in:
Run Edit