title: Printing two arrays in csv side by side
body: <p>I have two <code>String</code> arrays: sentence and score.</p>
  
  <p>I want to create a .csv file in which the first column is made of elements from sentence and the second column is made of elements from score.</p>
  
  <p>I'm having trouble understanding where the problem in my code is and how to fix it.</p>
  
  <pre><code>import java.io.File;
  import java.io.PrintWriter;
  
  public class GeneraCsv {
      public static void main(String[] args) throws Exception {
          String[] sentence = {"sentence 1", "sentence 2", "sentence 3"};
          String[] score = {"score 1", "score", "score 3"};
          PrintWriter pw = new PrintWriter(new File("C:/Users/Gonzalo/Desktop/test.csv"));
          StringBuilder sb = new StringBuilder();
          sb.append("sentence");
          sb.append(';');
          sb.append("score");
          sb.append('\n');
          for(String a: sentence) {
              sb.append(a);
              sb.append(";");
              for(String b: score) {
                  sb.append(b);
                  sb.append('\n');
                  break;
              }
          }
          pw.write(sb.toString());
          pw.close();
          System.out.println("done!");
      }
  }
  </code></pre>
  
  <p>My code generates this:</p>
  
  <pre><code>sentence; score
  sentence 1; score 1
  sentence 2; score 1
  sentence 3; score 1
  </code></pre>
  
  <p>The first column is fine, the second is not.</p>
  
  <p>The output I want should be like:</p>
  
  <pre><code>sentence; score
  sentence 1; score 1
  sentence 2; score 2
  sentence 3; score 3
  </code></pre>
  
  <p>I'm sure there is a problem in the loops somewhere. </p>
  
  <p>How to fix?</p>