1
Vote

'return' from 'lambda' returns from method (like 'return' from 'proc')

description

'return' from 'lambda' returns from method (like 'return' from 'proc')
def self.testing
    #Dotnet::Debugger.break
    test_proc = proc do
        puts 'test_proc 1'
        1.upto(1) { return }
        puts 'test_proc 2'
    end

    test_lambda = lambda do
        puts 'test_lambda 1'
        1.upto(1) { return }
        puts 'test_lambda 2'
    end
    
    puts 'testing 1'
    test_lambda[]
    puts 'testing 2'
    test_proc[]
    puts 'testing 3'
end

testing
output should be:
testing 1
test_lambda 1
testing 2
test_proc 1

comments

iulianfecioru wrote Jun 20, 2014 at 7:10 AM

RESOLVED

wrote Jun 20, 2014 at 7:24 AM