title: Function, which returns the next 50 leap years
body: <p>I need to create a function that would return the next 50 leap years beginning from the next leap year after the input year in R. The problem is that I need to save it as a vector.</p>
  
  <pre><code>x &lt;- function(year){
  year1 &lt;- year + 205
  for(i in year:year1){
  if((i %% 4 == 0) &amp; (i %% 100 != 0) | (i  %% 400 == 0)){
  print(i)
  }
  next
  }
  }
  </code></pre>
  
  <p>In this function I created the vector for years which would include at least the next 50 leap years, but I guess, there is a way where R just closes the loop when it has 50 values in a vector.
  Thanks!</p>