Skip to content

Instantly share code, notes, and snippets.

@kmizu
Created October 3, 2010 04:07
Show Gist options
  • Save kmizu/608253 to your computer and use it in GitHub Desktop.
Save kmizu/608253 to your computer and use it in GitHub Desktop.
class RichInt(n: Int) {
def times(f: Int => Unit): Int = {
0 until n foreach f
n
}
}
implicit def enrichInt(n: Int) = new RichInt(n)
3.times{i =>
println(i)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment