I am trying to compare two strings in Scala. Below is the function.
def max(x:Int, y:String): String = {
| if (y=="Happy") "This is comparing strings as well"
| else "This is not so fair"
| if (x > 1) "This is greater than 1"
| else "This is not greater than 1"
| }
From some answers I assumed that I can use '==' symbol to compare the strings. I have given the following inputs and got the following outputs. what am I missing or Scala is behaving differently?
max (1,"Happy")
res7: String = This is not greater than 1
println(max(2, "sam"))
This is greater than 1