ext dup

Ruby code posted
created at 13 Dec 17:53, updated at 14 Dec 00:26

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 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
415 Bytes in 2 ms with coderay