The power

Report a typo

We have a Logger object in the scope:

object Logger:
  def info(message: String): Unit = println(s"[INFO] $message")

We needed to write a function called pow. It had to use a function from the mathematical library and log the result. We added an import to the scope that won't conflict with the function name:

import scala.math.{pow as power}

However, something went wrong. Fix the errors in the code so that we can see the logs during the call and so that the power of numbers is calculated correctly.

Sample Input 1:

2
3

Sample Output 1:

[INFO] 2^3 = 8
8
Write a program in Scala 3
def pow(a: Int, b: Int): Int =
val result = pow(a, b).toInt
info(s"$a^$b = $result")
result
___

Create a free account to access the full topic