title: Saving loop outcomes in Julia programming language
body: <p>I have been trying to learn Julia for I believe that it is a good alternative compared to the others that are in the "market"  nowadays. However, since Julia is a new language---and because there is not even one book out there to help the novice---, I start this thread here, although my question may be very basic.</p>
  
  <p>So here it is: Assume that I write the following code and I want to save my results in a csv file.</p>
  
  <pre><code>csvfile = open("y_save.csv","w")
  write(csvfile,"y, \n")
  
  # Set up the function
  foo(i) = i^2
  
  # Start the for loop
  
  for i = 1:20
      y= foo(i)
      y_save = y
      write(csvfile, y_save,",", "\n")
  end
  </code></pre>
  
  <p>The code that I wrote before is from this site: <a href="http://comments.gmane.org/gmane.comp.lang.julia.user/21070" rel="nofollow">http://comments.gmane.org/gmane.comp.lang.julia.user/21070</a></p>
  
  <p>Although I was able to make that work, I do not understand what I am doing wrong and the result I get in the csv is not readable.</p>
  
  <p>I hope someone can provide some assistance with it.
  Thanks in advance!</p>