Files
compiler-explorer/examples/ocaml/max_array.ml
2018-12-15 21:31:15 +03:00

9 lines
158 B
OCaml

let max_array array =
let max = ref 0 in
for i = 0 to Array.length array do
let el = array.(i) in
if el > !max
then max := el;
done;
!max