Title / Description
Code # Define a method that calls lambda def lambda_method lambda { puts 'Hello from lambda!'; return }.call puts 'Hello from lambda_method' end # Define a method that calls proc def proc_method proc { puts 'Hello from proc!'; return }.call puts 'Hello from proc_method' end lambda_method proc_method # Output: # Hello from lambda! # Hello from lambda_method # Hello from proc
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code