title: OCAML function doesn't print correctly
body: <p>So I have to create a &quot;lights out&quot; game. I have to create two functions. One function &quot;flip&quot;</p>
  <blockquote>
  <p>val flip : bool array array -&gt; int -&gt; int -&gt; bool array array = &lt; fun &gt;</p>
  </blockquote>
  <p>that given a bool matrix and two integers i, j. it negates the values
  (true→false, false→true) at location i, j in the matrix, as well negating
  the values on the (up to) 4 horizontally/vertically adjacent elements.</p>
  <p>This is my code about it:</p>
  <p>`</p>
  <pre><code>let matrixz =         [|[|true;true;false;false|];
                        [|false;false;true;true|];
                        [|true;false;true;false|];
                        [|true;false;false;true|]|];;
  
  let flip_matrix matrix a b=
  let n=Array.length matrix in
      for i=1 to n do 
   let n1=Array.length matrix in
        for j=1 to n1 do
          if i=a &amp;&amp; j=b
          then begin 
              matrix.(i).(j)&lt;- not matrix.(i).(j);
              matrix.(i+1).(j)&lt;- not matrix.(i+1).(j);
              matrix.(i).(j+1)&lt;- not matrix.(i).(j+1); 
              matrix.(i).(j-1)&lt;- not matrix.(i).(j-1);
              matrix.(i-1).(j)&lt;- not matrix.(i-1).(j);
          end;
         done;
      done;
  matrix;; `
  </code></pre>
  <p>Which I think is correct. But also I have to make another function:</p>
  <blockquote>
  <p>val print_matrix : bool array array -&gt; unit = </p>
  </blockquote>
  <p>Which given a bool matrix, it prints it on screen (true →”T”, false→”F”).</p>
  <p>This is my code about it:</p>
  <pre><code>let print_s matrix=
    let n=Array.length matrix in
      for i=0 to n-1 do 
        let n1=Array.length matrix in
          for j=0 to n1-1 do
           print_string matrix.(i).(j);
          done; 
         print_string &quot;/n&quot;;
        done;
  </code></pre>
  <p>This would be the correct output:</p>
  <pre><code># flip matrix 1 4;;
  # print_matrix matrix;;
  FTFT
  TFFF
  FFTT
  </code></pre>
  <p>I know the second function is incorrect. I would appreciate some help and suggestion as I'm really new to Ocaml.</p>