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

  • SEARCH
  • Home
  • 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 159251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:49:33+00:00 2026-05-11T10:49:33+00:00

If I say: x = abc this seems like a declaration, definition and assignment,

  • 0

If I say:

x = ‘abc’

this seems like a declaration, definition and assignment, all at the same time, regardless of whether I have said anything about x in the program before.

Is this correct?

I’m not sure what the correct terminology is in Ruby for declarations, definitions and assigments or if there is even a distinction between these things because of the dynamic typing in Ruby.

@tg: Regarding your point # 2: even if x existed before the x = ‘abc’ statement, couldn’t you call the x = ‘abc’ statement a definition/re-definition?

  • 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. 2026-05-11T10:49:33+00:00Added an answer on May 11, 2026 at 10:49 am
    1. Declaration: No.
      It doesn’t make sense to talk about declaring variables in Ruby, because there’s nothing analogous to a declaration in the languages. Languages designed for compilers have declarations because the compiler needs to know in advance how big datatypes are and how to access different parts of them. e.g., if I say in C:

      int *i; 

      then the compiler knows that somewhere there is some memory set aside for i, and it’s as big as it needs to be to hold a pointer to an int. Eventually the linker will hook all the references to i together, but at least the compiler knows it’s out there somewhere.

    2. Definition: Probably.
      A definition typically set an initial value for something (at least in the familiar compiled languages). If x didn’t exist before the x = 'abc' statement, then I guess you could call this a definition, since that is when Ruby has to assign a value to the symbol x.

      Again, though, definition is a specific term that people typically use to distinguish the initial, static assignment of a value to some variable from that variable’s declaration. In Ruby, you don’t have that kind of statement. You typically just say a variable is defined if it’s been assigned a value somewhere in your current scope, and you say it’s undefined if it hasn’t.

      You usually don’t talk about it having a definition, because in Ruby that just amounts to assignment. There’s no special context that would justify you saying definition like there is in other languages.

      Which brings us to…

    3. Assignment: Yes.
      You can definitely call this an assignment, since it is assigning a value to the symbol x. I don’t think anyone will disagree with that.

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

Sidebar

Ask A Question

Stats

  • Questions 82k
  • Answers 82k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You cant change a primary key on a published table… May 11, 2026 at 4:41 pm
  • Editorial Team
    Editorial Team added an answer One (convoluted) solution is to compress it first. A textual… May 11, 2026 at 4:41 pm
  • Editorial Team
    Editorial Team added an answer "The only purpose of the app is basically to pull… May 11, 2026 at 4:41 pm

Related Questions

I am working on an idea wherein I have to identify lines in a
After learning about how to print out debug messages using Visual Studio's Tracepoint feature,
I'm trying to foresee how big my database will be. Let's say I have
I thought that to clone a List you would just call: List<int> cloneList =

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.