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

Related Questions

Say I have a jQuery plugin like $.abc = function() {}. Now I want
I have a repository, say abc/myprject.git . I have this repo on a server
I have a string that contains something like this: ##### abc 'foo' /path/to/filename:1 #####
Lets say that you have websites www.xyz.com and www.abc.com. Lets say that a user
Let's say I want to write a regular expression to change all <abc> ,
Say I have a class named Frog, it looks like: public class Frog {
I have html page say abc.htm it has 2 anchors which are pointing to
i have a page,say abc.html, that is having a small form with some fields.
Lets say i has a file name abc.txt This file has three strings how
Google is failing me on this one. Let's say I have some ECMA script

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.