Feel the basic type and reference type easily with ruby 2

It is a pattern that does not use the method of Feel basic type and reference type easily with ruby.

Launch Ruby on mac terminal

   irb

When the value of the basic type of the reference type value is changed

temp=[1,2]
temp2=temp
temp2[0]=11
temp #[11, 2]

The values (reference values) of temp and temp2 are the same

When the reference type value itself is changed

temp=[1,2]
temp2=temp
temp2=11
temp #[1, 2]

The values (reference values) of temp and temp2 are different

Recommended Posts

Feel the basic type and reference type easily with ruby
Feel the basic type and reference type easily with ruby 2
Basic data type and reference type
With ruby ● × Game and Othello (basic review)
[Ruby] Basic code list. Keep the basics with examples
[Ruby] Method to easily get the receiver type .class
About Java basic data types and reference type memory
Ruby methods and classes (basic)
Find the address class and address type from the IP address with Java
[Java] Difference between assignment of basic type variable and assignment of reference type variable
The difference between programming with Ruby classes and programming without it
Easily try Ruby 3.0.0 type checking (rbs)
Basic data types and reference types (Java)
Programming with ruby (on the way)
Difference between primitive type and reference type
Java basic data types and reference types
Find the address class and address type from the IP address with Java [No. 2 decoction]
Determine the device type of smartphones, tablets, and PCs with Spring Mobile
[Firestore] Extract the collection with where condition in Ruby and delete the record
Do your best with gRPC with ruby ​​on the server and PHP on the client
Introduction to Ruby basic grammar with yakiniku
Convert JSON to TSV and TSV to JSON with Ruby
[Ruby] Difference between methods with and without self in the class. About class methods and instance methods.
[Ruby] Arguments with keywords and default values of arguments
I implemented Ruby with Ruby (and C) (I played with builtin)
Try to link Ruby and Java with Dapr
Publish the app made with ruby on rails
Manage the version of Ruby itself with rbenv
[Ruby] "Reference to object" and "Contents of variable"
[Competition Pro] Solve the knapsack problem with Ruby
Easily monitor the indoor environment- (1) Motivation and concept-
Solving with Ruby and Crystal AtCoder ABC 129 D
Easily edit performance videos with ffmpeg using Ruby
[Ruby] Exclude duplicate elements with the uniq method.
Determine the current page with Ruby on Rails
Finding pi with the Monte Carlo method? (Ruby)
Java review ③ (Basic usage of arrays / reference type)
I checked the number of taxis with Ruby
[Ruby] Setting values ​​and memorandum for the table
[Beginner's point of view] I tried to solve the FizzBuzz problem "easily" with Ruby!