I have searched Scala doc and do not see any explanation on “that” keyword.
if any one have a good explanation/example on how/where to use “this/that” keyword would be very usable.
that
is not a keyword. It’s just a name some people like to use for a variable that refers to an instance of the current class.
class A {
def isTheSameAs(that: A) = this == that
}
2 Likes
Thank you very much Jasper-M.
Don’t withdraw the question. It might be useful to someone else having the same question. Experts easily forget which things are confusing to beginners.
3 Likes