On Thu, Dec 8, 2011 at 9:09 AM, Rob Marshall <robmarshall / iglide.net> wrote:

> Hi Robert,
>
> Well, for someone who is new to Ruby, how would I, or anyone for that
> matter, know that doing: '11.to_s *2' converts the number 11 to binary
> when '11.to_s * 2' and 11.to_s*2 both do string multiplication as
> expected. Especially since whitespace isn't supposed to matter.
>
>
FWIW, ruby will warn you about ambiguous syntax if you run it with warnings
turned on.

This code:

puts 11.to_s *
2
puts 11.to_s
*2
puts 11.to_s*2

Outputs:

$ ruby -w test_warnings.rb
test_warnings.rb:2: warning: `*' interpreted as argument prefix
1111
1011
1111

pete