title: Unexpected symbol in function (R language)
body: <p>I'm trying out the following piece of code from the book "The Art of R Programming" and for some reason I get the error message "Error: unexpected symbol in "first1 &lt;- function(x) {for (i in 1:length(x)) {if (x[i] == 1) break} return"
  This code is exactly as shown in the book (except that I'm unable to split each line on its own line). </p>
  
  <p>The function seems to work fine when I remove return(i).</p>
  
  <pre><code>first1 &lt;- function(x) {for (i in 1:length(x)) {if (x[i] == 1) break} return(i) }
  </code></pre>