From 2c3364bf962c231d91e534dfbab52a865a2b9562 Mon Sep 17 00:00:00 2001 From: Matt Blair Date: Thu, 14 Apr 2011 22:23:32 -0400 Subject: [PATCH] finished chapter 3 --- ch03/variables/09.rb | 4 ++++ ch03/variables/10.rb | 5 +++++ ch03/variables/11.rb | 5 +++++ ch03/variables/12.rb | 4 ++++ 4 files changed, 18 insertions(+) create mode 100644 ch03/variables/09.rb create mode 100644 ch03/variables/10.rb create mode 100644 ch03/variables/11.rb create mode 100644 ch03/variables/12.rb diff --git a/ch03/variables/09.rb b/ch03/variables/09.rb new file mode 100644 index 0000000..7656345 --- /dev/null +++ b/ch03/variables/09.rb @@ -0,0 +1,4 @@ +person = "Tim" +puts "The object in 'person' is a #{person.class}" +puts "The obbject has an id of #{person.object_id}" +puts "and a value of #{person}" diff --git a/ch03/variables/10.rb b/ch03/variables/10.rb new file mode 100644 index 0000000..1796652 --- /dev/null +++ b/ch03/variables/10.rb @@ -0,0 +1,5 @@ +person1 = "Tim" +person2 = person1 +person1[0] = "J" +puts "person1 is #{person1}" +puts "person2 is #{person2}" diff --git a/ch03/variables/11.rb b/ch03/variables/11.rb new file mode 100644 index 0000000..bcc5351 --- /dev/null +++ b/ch03/variables/11.rb @@ -0,0 +1,5 @@ +person1 = "Tim" +person2 = person1.dup +person1[0] = "J" +puts "person1 is #{person1}" +puts "person2 is #{person2}" diff --git a/ch03/variables/12.rb b/ch03/variables/12.rb new file mode 100644 index 0000000..fd2f7c8 --- /dev/null +++ b/ch03/variables/12.rb @@ -0,0 +1,4 @@ +person1 = "Tim" +person2 = person1 +person1.freeze +person1[0] = "J"