Created
July 9, 2014 09:10
-
-
Save eamelink/7f867992292f7115ded1 to your computer and use it in GitHub Desktop.
Ruby to Scala snippet
This file contains hidden or 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
// 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