Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OCaml syntax for defining a helper function inside of another function?

I apologize if this is a silly question, but I'm a newbie to OCaml and I wasn't able to find examples of this anywhere. Could somebody give me a simple example of the Ocaml syntax for defining a helper function inside of another function?

Thank you!

like image 246
Sachi Murasaki Avatar asked Dec 03 '25 02:12

Sachi Murasaki


1 Answers

Here you go:

let outer x y =
  let inner z = x + z
  in inner y
like image 192
Andreas Rossberg Avatar answered Dec 04 '25 19:12

Andreas Rossberg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!