Loading ...
Sorry, an error occurred while loading the content.
 

Re: "ocaml_beginners"::[] for loop and side effects

Expand Messages
  • Martin Jambon
    ... It explicitely written in the manual: Part II - The Objective Caml language - Expressions - Loops Martin -- Martin Jambon, PhD
    Message 1 of 2 , Apr 4, 2005
      On Mon, 4 Apr 2005, Radu Grigore wrote:

      > This code:
      > let r = ref 10;;
      > for i = 1 to !r do incr r done;;
      > terminates, which means that <e1> and <e2> in
      > for i = <e1> to <e2> do <e3> done;;
      > are evaluated once. This is what I expected. However I couldn't find
      > any place in the doc that specifies this behavior. Can we rely on it?

      It explicitely written in the manual:
      Part II -> The Objective Caml language -> Expressions -> Loops


      Martin

      --
      Martin Jambon, PhD
      http://martin.jambon.free.fr
    Your message has been successfully submitted and would be delivered to recipients shortly.