let accum = ref 0;; 
let m3 = ref 0;; 
let m5 = ref 0;; 

for i = 1 to 10 do  
    m3 := i mod 3;
    m5 := i mod 5;
    (*  
    *)
    accum := if (m3 = 0) || (m5 = 0) then !accum + i else !accum + 0;
    print_int (!accum + i); 
    print_newline (); 
done;

Add a code snippet to your website: www.paste.org