Site menu

CodeCook.io

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

Scala - 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.

0
631
  • Share on Facebook
  • Share on Google+
  • Share on Twitter

Create a list of numbers

for ( i <- {{start}} to {{stop}}) yield {
  {{body}}
}
java

Notes

last update: Oct. 26, 2014

0
619
  • Share on Facebook
  • Share on Google+
  • Share on Twitter

Side effect over a range of numbers

for ( i <- {{start}} to {{stop}}) {
  {{body}}
}
java

Notes

last update: Oct. 26, 2014

Advertisement

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

Related concept

  • For each loop
  • Loop until condition is true
  • Do loop while a condition is true
  • Loop while condition is true
  • Break out of loop

Other language

  • C++
  • Java
  • Python
  • JavaScript
  • PHP
  • Ruby

Random task

  • Find index of item in array
  • Transform scale
  • Create new repository
  • Get specific element from list of Protractor returned elements for locator
  • Random integer in range
  • Blog
  • About
  • License