In the following code, Scala is unable to convert Into to String. Why?
object Upper{
def main(args:Array[String]){
val number:Int= 1;
val no=3.3;
println(args.map(_.toUpperCase())+(no+number));
}
}
Error is
error: type mismatch;
found : Int
required: String
println(args.map(_.toUpperCase())+(no+number));
^
one error found
no + numberto a string yourself usingtoStringor"" +. If not, your problem is not related to the fact that the number isn't converted to a string and you need to explain what you actually want to happen.