Actually, your C code is almost valid OCaml code.
if x = y + 1 then
(* some code *)
else if x = y - 1 then
(* some code *)
else if x = y + 2 then
....
Pattern matching is not a replacement for if then
, it has a completly different purpose. OCaml allows you to construct types such as type 'a option = None | Some of 'a
and pattern matching should be used to deconstruct those types. It sould not be used for other purposes.