Jump to content

Integer sequence: Difference between revisions

added ocaml
(→‎{{header|Ada}}: add second alternative)
(added ocaml)
Line 160:
}
}</lang>
=={{header|OCaml}}==
with an imperative style:
<lang ocaml>let no () =
let i = ref 0 in
while true do
print_int !i;
print_newline ();
incr i;
done</lang>
 
with a fonctional style:
<lang ocaml>let () =
let rec aux i =
print_int i;
print_newline ();
aux (succ i)
in
aux 0</lang>
 
=={{header|Perl}}==
<lang perl>my $i = 0;
print ++$i, "\n" while 1;</lang>
 
=={{header|Perl 6}}==
<lang perl6>.say for 1..*</lang>
Cookies help us deliver our services. By using our services, you agree to our use of cookies.