Appendix A. irb Results

Here's a transcript of the irb session described near the end of Day 1.

irb(main):001:0> 99 < 100
					true
irb(main):002:0> 99 <= 100
					true
irb(main):003:0> 100 <= 100
					true
irb(main):004:0> 100 == 100
					true
irb(main):005:0> 100 = 100
SyntaxError: compile error
(irb):5: parse error
100 = 100
     ^
        from (irb):5
irb(main):006:0> perfect_score = 100
					100
irb(main):007:0> "99" < 100
TypeError: failed to convert Fixnum into String
        from (irb):7:in `<=>'
        from (irb):7:in `<'
        from (irb):7
irb(main):008:0> "99".type
					String
irb(main):009:0> 100.type
					Fixnum
irb(main):010:0> "99".length
					2
irb(main):011:0> 100.length
NameError: undefined method `length' for 100:Fixnum
        from (irb):11
irb(main):012:0> "99" < "100"
					false
irb(main):013:0> "99" > "100" ...

Get Sams Teach Yourself Ruby in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.