Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7819963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:08:00+00:00 2026-06-02T07:08:00+00:00

I am reading along in pickaxe 1.9 and the author uses lambda like this:

  • 0

I am reading along in pickaxe 1.9 and the author uses lambda like this:

bo = lambda {|param| puts "You called me with #{param}"}
bo.call 99     => 'You called me with 99'
bo.call "cat"  => 'You called me with cat'

My question is this: How is this any better/worse/different than just defining a method that does that same thing? Like so:

def bo(param)
  puts "You called me with #{param}"
end

bo("hello") => 'You called me with hello'

To me the lambda syntax seems much more confusing and spaghetti-like.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T07:08:01+00:00Added an answer on June 2, 2026 at 7:08 am

    Lambdas:

    • are variations of Procs,
    • can be converted to/from blocks,
    • do not begin a new closure scope (meaning you can access variables defined outside the scope of your lambda, unlike def),
    • can be passed around as variables.

    I recommend checking out this article that explain procs, blocks, and lambdas.

    Edit: This link is outdated. For future reference, try this article

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Reading along with the agile book, it says this in a footnote: ... You
I was reading the Rails Tutorial and following along like a good drone installing
I'm reading about ASP.net MVP pattern over this weekend and it seem like even
I'm reading along in this tutorial and i get down towards the end in
I'm new to iOS programming and I'm reading this tutorial to get along http://www.raywenderlich.com/1797/how-to-create-a-simple-iphone-app-tutorial-part-1
I have a long text and I'd like to offer the user a reading
Reading Java Concurrency In Practice, there's this part in section 3.5: public Holder holder;
After reading the tips from this great Nettuts+ article I've come up with a
I have been reading StackOverflow for a while and now I have a question
Does anyone know of any free and working external libraries for reading emails in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.