You can pass an anonymous function or lambda:<p><pre><code>    def foo(thing, block):
      thing = "cruel " + thing
      block(thing) # like `yield thing' or 'block.call' in ruby

    def bar(thing):
      return "hello " + thing

    foo('world', bar)

    # or:
    foo('world', lambda x: "hello " + x)
</code></pre>
Ruby's blocks are really just sugar for passing an anonymous function in the last argument and yield is just sugar for calling that function. The example above in Ruby would be:<p><pre><code>    def foo(thing)
      yield thing
    end

    foo('world') { |thing| "hello " + thing }</code></pre>