Mode:
Duration:
1
2
let print_even lst = List.iter (fun x -> if x mod 2 = 0 then Printf.printf "%d\n" x) lst
let () = print_even [1;2;3;4;5]Coding works best on desktop or with an external keyboard.
let print_even lst = List.iter (fun x -> if x mod 2 = 0 then Printf.printf "%d\n" x) lst
let () = print_even [1;2;3;4;5]Coding works best on desktop or with an external keyboard.
Prints even numbers from a list.
let print_even lst = List.iter (fun x -> if x mod 2 = 0 then Printf.printf "%d\n" x) lst
let () = print_even [1;2;3;4;5]OCaml is a functional, imperative, and object-oriented programming language in the ML family. It features strong static typing, type inference, and a powerful module system, making it suitable for compiler construction, systems programming, and formal verification.
Origin & Creator
Developed in 1996 by Xavier Leroy and the INRIA team in France as an extension of the Caml language.
Industrial Note
OCaml is widely used in formal methods, theorem provers (e.g., Coq), and financial software requiring high reliability.