# Re: simple loops and recursion

**URL:** <https://www.ruby-forum.com/t/re-simple-loops-and-recursion/77432>\
**Category:** Ruby\
**Created:** [November 27, 2006, 11:59pm UTC](https://www.ruby-forum.com/t/re-simple-loops-and-recursion/77432 "2006-11-27T23:59:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![phrogz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/2acd7d/32.png) [@phrogz](https://www.ruby-forum.com/u/phrogz)\
**Post date:** [November 27, 2006, 11:59pm UTC](https://www.ruby-forum.com/t/re-simple-loops-and-recursion/77432/1 "2006-11-27T23:59:09Z")

</div>

From: ishamid [[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)]

> ```
> puts "Sorry, expected #{expected_value} but got #{actual_value}"
> 
> ```

…

> The output does not distinguish number from numeral. Is this standard  
> or is there something else going on?

The string representation (the output of the to\_s method) for strings  
and numbers is identical in this case. You might want to use the output  
of the ‘inspect’ method instead, as this occasionally returns values  
that are more in-line with what you want.

# puts “Sorry, expected #{expected\_value.inspect} but got #{actual\_value.inspect}”

# Sorry, expected “98” but got 98

[1, ‘1’, 1.275392, ‘1.275392’, nil, /woot/].each do |obj|  
puts “#{obj.to\_s} vs #{obj.inspect}”  
end

#=\> 1 vs 1  
#=\> 1 vs “1”  
#=\> 1.275392 vs 1.275392  
#=\> 1.275392 vs “1.275392”  
#=\> vs nil  
#=\> (?-mix:woot) vs /woot/
