Let's say I want to make a little wrapper along the lines of:

def wrapper(f: (Any) => Any): Any = {
  println("Executing now")
  val res = f
  println("Execution finished")
  res
}

wrapper {
  println("2")
}

Does this make sense? My wrapper method is obviously wrong, but I think the spirit of what I want to do is possible. Am I right in thinking so? If so, what's the solution? Thanks!

Edit
Report