-2

puts ((11.to_s * 2).to_i/2), does anyone know answer of this coding? I am not aware of ruby!

Sven
  • 97,248
  • 13
  • 177
  • 225
rumain
  • 1
  • This isn't a proper question at all and, being programming related, off-topic anyway. Please read our [FAQ]. – Sven Jun 26 '12 at 07:01
  • For your future reference this kind of question is better asked on stackoverflow.com – user9517 Jun 26 '12 at 07:14

1 Answers1

1

I just learned enough ruby to do this

ruby -e "puts ((11.to_s * 2).to_i/2)"
555

which doesn't help much

ruby -e "puts (11.to_s * 2)"
1111

So it appears to convert 11 to a string (.to_s) then doubles it then converts the answer back to an integer (.to_i) and then divides it by 2.

user9517
  • 114,104
  • 20
  • 206
  • 289