Site menu

CodeCook.io

  • Languages
    • C
    • C++
    • CSS
    • Git
    • HTML
    • Java
    • JavaScript
    • jQuery
    • PHP
    • Python
    • Ruby
    • Scala
  • for
  • loop

Ruby - Counter loop

Execute piece of code for a range of numbers.

  • Default
  • Loop 10

Execute body for integers 0 to 10 including 0 and excluding 10.

1
543
  • Share on Facebook
  • Share on Google+
  • Share on Twitter
for i in {{start}}..{{stop}}
  {{body}}
end
ruby

Notes

last update: Oct. 28, 2014

Advertisement

This project is hosted on DigitalOcean, try it and support us

Related concept

  • Loop while condition is true
  • Do loop while a condition is true
  • Loop until condition is true

Other language

  • C++
  • Java
  • Scala
  • Python
  • JavaScript
  • PHP

Random task

  • Loop until condition is true
  • Object instantiation
  • Key value item count
  • Create git tag
  • Font-face
  • Blog
  • About
  • License