In Ruby, everything is an object; so they say. Is it true? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

In Ruby, everything is an object; so they say. Is it true?

In Ruby, everything is an object; so they say. But I think that it should be "Everything else apart from variables, is an object. " This is because variables act as a reference point to the objects they represent. What do you guys think?

5th Apr 2019, 5:43 AM
William Otieno
William Otieno - avatar
2 Answers
+ 4
What is a variable ? A reference to a portion of memory which containts encapsulated data and methods? I prefer to think about it as objects. I think that variables and predefined constants must be considered objects https://code.sololearn.com/cVY5jy9MjKX0/?ref=app
7th Apr 2019, 9:21 AM
Javier Felipe Toribio
Javier Felipe Toribio - avatar
0
Javier Felipe Toribio I don't think that's true, as variables are replaced with the memory locations when the Bytecode is generated.
23rd Jul 2021, 10:53 AM
Calvin Thomas
Calvin Thomas - avatar