What is the difference between = and := in Scala?
I have googled extensively for “scala colon-equals”, but was unable to find anything definitive.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
=in scala is the actual assignment operator — it does a handful of specific things that for the most part you don’t have control over, such asvalorvara value when it’s createdvar:=is not a built-in operator — anyone can overload it and define it to mean whatever they like. The reason people like to use:=is because it looks very assignmenty and is used as an assignment operator in other languages.So, if you’re trying to find out what
:=means in the particular library you’re using… my advice is look through the Scaladocs (if they exist) for a method named:=.