現在、RubyのHackerRankの問題に取り組んでいます。私は、これらの二つの変数はいずれも文字列ではありませんので、私は理解していない次の行in `+ ':文字列をFixnum(TypeError)に強制することはできません
print d + double
に
in `+': String can't be coerced into Fixnum (TypeError)
をコンパイルしようとします。
i = 4
d = 4.0
s = 'HackerRank'
# Declare second integer, double, and String variables.
intOne = 12
double = 4.0
string = "is the best place to learn and practice coding!, we get HackerRank is the best place to learn and practice coding!"
# Read and save an integer, double, and String to your variables.
intOne = gets.chomp
double = gets.chomp
string = gets.chomp
# Print the sum of both integer variables on a new line.
print i + intOne
# Print the sum of the double variables on a new line.
print d + double
# Concatenate and print the String variables on a new line
print s + string
# The 's' variable above should be printed first.
5行、あなたはそれに 'STRING'を割り当てます。もちろん、それは 'String'です! –