Name: Anonymous 2006-10-11 13:32
puts '12'.to_i + 12
puts '1234 qdasasjkdaklsj'.to_i
puts 12.to_s + 'asd'
puts 'lolhi.pick a number'
numb = gets.to_i
puts numb.chomp.to_s + 1 + 'is a better number, faggot'
SHOULD read
24
1234
lolhi.pick a number
[number]
([number]+1) is a better number, faggot.
Instead it reads
24
1234
lolhi.pick a number
[number]
sandbox.rb:7:in '+': String can't be coerced into Fixnum (TypeError) from sandbox.rb:7
Someone please tel me why this is a complete fialuer? to_i obviously works, but can I not use it on a string in a variable? If so, shit sucks.
puts '1234 qdasasjkdaklsj'.to_i
puts 12.to_s + 'asd'
puts 'lolhi.pick a number'
numb = gets.to_i
puts numb.chomp.to_s + 1 + 'is a better number, faggot'
SHOULD read
24
1234
lolhi.pick a number
[number]
([number]+1) is a better number, faggot.
Instead it reads
24
1234
lolhi.pick a number
[number]
sandbox.rb:7:in '+': String can't be coerced into Fixnum (TypeError) from sandbox.rb:7
Someone please tel me why this is a complete fialuer? to_i obviously works, but can I not use it on a string in a variable? If so, shit sucks.