0
respostas

Type mismatch

Estou acompanhando as aulas montei a função como foi mostrado no vídeo estou recebendo o erro abaixo:

Error:(24, 41) Kotlin: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: 
public fun Array<BigDecimal>.somatoria(): BigDecimal defined in br.com.alura.array in file Ranges.kt
  val gastoInicial = salariosComAumento.somatoria()
  println("$gastoInicial")

}

fun Array<BigDecimal>.somatoria(): BigDecimal {
  return this.reduce { acumulador, valor ->
    acumulador + valor
  }
}

Garanta sua matrícula hoje e ganhe + 2 meses grátis

Continue sua jornada tech com ainda mais tempo para aprender e evoluir

Quero aproveitar agora