From 3fac38df8d505b110dadeeb0170d80229314a762 Mon Sep 17 00:00:00 2001 From: Eddie Antonio Santos Date: Fri, 16 Aug 2019 12:44:56 -0600 Subject: [PATCH 1/3] Fix merge conflicts. --- slides.html | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/slides.html b/slides.html index 85bf068..884bc41 100644 --- a/slides.html +++ b/slides.html @@ -289,7 +289,7 @@

Part 2

We just used the *integer* number **class** but there are many more. - * Integer/Fixnum (whole numbers) + * Integer (whole numbers) * Float (numbers containing decimals) * String (words, sentences, literal text) - requires quotes * Boolean (`true`, `false`) @@ -302,11 +302,15 @@

Part 2

=> String irb> 42.class - => Fixnum + => Integer irb> 3.14159.class => Float ``` + + Heads up! Older versions of Ruby call it `Fixnum` instead of + `Integer`. For the purposes of this workshop, whenever you see + `Integer` in your code, you can safely replace it with `Fixnum`.
@@ -420,8 +424,8 @@

Part 2

But what if we try to join a string and a number? ```ruby - irb> puts 2 + "2" - TypeError: String cannot be coerced into Fixnum + irb> print 2 + "2" + TypeError: String cannot be coerced into Integer ``` @@ -434,8 +438,8 @@

Part 2

Ruby needs to know the **type** of data the value is to figure out how to work with it. Let’s look at that error again. ```ruby - irb> puts 2 + "2" - TypeError: String cannot be coerced into Fixnum + irb> print 2 + "2" + TypeError: String cannot be coerced into Integer ``` * The first `2`, inside of `puts 2 + "2"` is an integer. @@ -513,8 +517,8 @@

Part 2

Ruby can also be used to convert numbers to strings. ``` - irb> puts 3 + " items in my bento!" - TypeError: String cant be coerced into Fixnum + irb> print 3 + " items in my bento!" + TypeError: String cant be coerced into Integer ``` Use the `.to_s` method to convert a number to a string. @@ -1021,8 +1025,8 @@

Part 2

``` ```ruby - irb> if x.class == Float || x.class == Fixnum - ... puts "x is a numeric value" + irb> if x.is_a?(Float) || x.is_a?(Integer) + ... print "x is a numeric value" ... end x is a numeric value ``` From 7d7af8f0ce457062c4133461db1af70c142c4ab5 Mon Sep 17 00:00:00 2001 From: Eddie Antonio Santos Date: Fri, 16 Aug 2019 12:49:03 -0600 Subject: [PATCH 2/3] Undo change of `puts` to `print` --- slides.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/slides.html b/slides.html index 884bc41..f2a7c7f 100644 --- a/slides.html +++ b/slides.html @@ -424,7 +424,7 @@

Part 2

But what if we try to join a string and a number? ```ruby - irb> print 2 + "2" + irb> puts 2 + "2" TypeError: String cannot be coerced into Integer ``` @@ -438,7 +438,7 @@

Part 2

Ruby needs to know the **type** of data the value is to figure out how to work with it. Let’s look at that error again. ```ruby - irb> print 2 + "2" + irb> puts 2 + "2" TypeError: String cannot be coerced into Integer ``` @@ -517,7 +517,7 @@

Part 2

Ruby can also be used to convert numbers to strings. ``` - irb> print 3 + " items in my bento!" + irb> puts 3 + " items in my bento!" TypeError: String cant be coerced into Integer ``` @@ -1026,7 +1026,7 @@

Part 2

```ruby irb> if x.is_a?(Float) || x.is_a?(Integer) - ... print "x is a numeric value" + ... puts "x is a numeric value" ... end x is a numeric value ``` From fc1e5ed4b272218fd5cac1c8e3b832711b359cd8 Mon Sep 17 00:00:00 2001 From: Eddie Antonio Santos Date: Mon, 7 Oct 2019 17:28:50 -0600 Subject: [PATCH 3/3] Remove confusing sentence. --- slides.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/slides.html b/slides.html index f2a7c7f..9482b69 100644 --- a/slides.html +++ b/slides.html @@ -309,8 +309,7 @@

Part 2

``` Heads up! Older versions of Ruby call it `Fixnum` instead of - `Integer`. For the purposes of this workshop, whenever you see - `Integer` in your code, you can safely replace it with `Fixnum`. + `Integer`.