title: object was not found in R
body: <p>i used following tutorial for learning R programming language
  <a href="https://www.tutorialspoint.com/r/r_repeat_loop.htm" rel="nofollow noreferrer">R programming language</a></p>
  
  <pre><code>v &lt;- c("Hello","loop")
  cnt &lt;- 2
  
  repeat {
    print(v)
    cnt &lt;- cnt+1
  
    if(cnt &gt; 5) {
      break
    }
  }
  </code></pre>
  
  <p>but when i run this code, it gave me the following error</p>
  
  <pre><code>&gt; if(cnt &gt; 5) {
  +     break
  +   }
  Error: object 'cnt' not found
  &gt; 
  </code></pre>
  
  <p>this example was taken from tutorial itself, what is    wrong  in  given code?</p>