Site menu

CodeCook.io

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

Scala - Break out of loop

Immediately exit a looping section regardless if loop condition is true.

Note: generally it is better to adjust the loop condition so the loop exits naturally when a specific situation occurs.

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

Using return

Warning: Not recommended practise in scala
return
java

Notes

last update: Oct. 26, 2014

Advertisement

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

Related concept

  • Counter loop
  • For each loop
  • Inline conditional
  • Loop while condition is true
  • Do loop while a condition is true
  • Loop until condition is true

Other language

  • Python
  • JavaScript
  • PHP

Random task

  • Find index of item in array
  • Merge branch into current branch
  • Django get domain current request
  • Append item to array
  • Transform scale
  • Blog
  • About
  • License