13968Re: "ocaml_beginners":: How can we rewrite pattern matching?
- Oct 22, 2013It would help if you'd say more precisely what you want to achieve. In that very case you can use an if expression:
if var = XType then myFun x else failwith "error"
Note that in your original code there is a type error, as raise takes an exception as argument, not a string.
What is another way to write the following code fragment:
match var withXType -> myFun x| _ -> raise("error")
- << Previous post in topic