I want to print the numbers that are not in the hashtable, in this case 1, 3 and 5. I'am getting the following error:
This expression has type int but an expression was expected of type
unit
Why does it expect type unit?
let l = [1; 2; 3; 4; 5];;
let ht = Hashtbl.create 2;;
Hashtbl.add ht 0 2;;
Hashtbl.add ht 1 4;
let n = List.iter (fun a -> if Hashtbl.mem ht a then -1 else a) l in
if n > 0 then print_int a;;