How can I code, in OCaml, something like this (main() in C)
for (i=0; i<y; i++)
if (x==5)
{
y=i;
return true;
}
It would return the boolean True and y would be equal to the corresponding i value.
Basically, in OCaml, I was wondering if you could have a if like:
for i=0 to y-1 do
if x=5 then
begin
y=i
true
end
else ()
done;;
I know the lines between begin-end aren't correctly implemented. I don't even know if what I want to do is possible in OCaml. If you are someone who has knowledge on this kindly share it with me. Thanks!
Aucun commentaire:
Enregistrer un commentaire