Created
December 17, 2012 15:34
-
-
Save tototoshi/4319159 to your computer and use it in GitHub Desktop.
break, continue in scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
exec scala "$0" "$@" | |
!# | |
import util.control.Breaks | |
val continue = new Breaks | |
Breaks.breakable { | |
for (i <- 1 to 10) { | |
continue.breakable { | |
if (i % 2 == 0){ | |
continue.break | |
} | |
println(i) | |
if (i == 7) { | |
Breaks.break | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment