jusynn
jusynn

Reputation: 1

Kotlin : Variable 'result' must be initialized

The compiler is showing error Kotlin: Variable result must be initialized.

Here is the code

enter image description here

Upvotes: 0

Views: 792

Answers (1)

hexin
hexin

Reputation: 977

In the when statement there is missing an initialization of the result variable, because it's expected to be.

when(intent...) {
    "+" -> result = something...
    ...
   else {
       result = something else...
   }
}

Upvotes: 1

Related Questions