0

When I use Invalid_argument() variant exception in a switch case, it expects a string argument.

let subStr = try(String.sub(input^, index, 1)) {
  | Invalid_argument(err) => ""
};

but if I don't use the err variable, it shows an unused variable warning.

Tahnik Mustasin
  • 2,216
  • 2
  • 18
  • 21

1 Answers1

1

Unused variables are prefixed by a _ in Reason.

Instead of

Invalid_argument(err)

you have to use

Invalid_argument(_err)
Tahnik Mustasin
  • 2,216
  • 2
  • 18
  • 21