I'm trying to write a function that will return the second smallest number in a list. I keep getting a syntax error but I can't really pinpoint what the issue is. Can I please get help on this?
Deleted code
I'm trying to write a function that will return the second smallest number in a list. I keep getting a syntax error but I can't really pinpoint what the issue is. Can I please get help on this?
Deleted code
You forget to close local
let
bindings usingin
. The correct (and indented) code should be:Top level
let
binding has the formbut local
let
binding has the formYou absolutely need to use a proper OCaml indentation tool for your editor to avoid this kind of errors.
One more thing. I am not sure your use of
!=
is ok. This is physical pointer comparison. Probably you want to use<>
, the structural comparison.