Skip to content

Instantly share code, notes, and snippets.

@eamelink
Created July 9, 2014 09:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eamelink/7f867992292f7115ded1 to your computer and use it in GitHub Desktop.
Save eamelink/7f867992292f7115ded1 to your computer and use it in GitHub Desktop.
Ruby to Scala snippet
// Ruby
def test
yield 5
puts "You are in the method test"
yield 100
end
test {|i| puts "You are in the block #{i}"}
// Scala
def test(fn: (Int) => ()) {
fn(5)
println("You are in the method test")
fn(100)
}
test(i => println(s"You are in the block $i"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment