Multi line function always has a block or not?

I don’t want to get started with any bad habits so is this something that should or shouldn’t exist now in the syntax? The formatter happily formats this. I stumbled across it reading some reasonml docs.

let hey = () =>
  if true {
    Js.log("this")
    Js.log("function")
    Js.log("has")
    Js.log("no")
    Js.log("block")
  }

hey()
1 Like

From what I understand, a block needs to be added if there are multiple expressions in the function body.

In your example there is only one if expression in the function body

4 Likes

That makes sense, I guess I was just thrown off by

“For longer functions, you’d surround the body with a block:”