Scala will transform the expression -2.0 into
the method invocation " (2.0).unary_- ".
If you want to change selection, open document below and click on "Move attachment"
Basic Types and Operations are -2.0, !found, and ~0xFF. As with the
infix operators, these prefix operators are a shorthand way of invoking methods. In this case,
however, the name of the method has "unary_" prepended to the operator character. For instance, <span>Scala will transform the expression -2.0 into
the method invocation "(2.0).unary_-". You can demonstrate this to yourself by typing the method call both via operator notation and explicitly:
scala> -2.0 // Scala invokes (2.0).unary_-
res2: Doub
Summary
status
not read
reprioritisations
last reprioritisation on
suggested re-reading day
started reading on
finished reading on
Details
Discussion
Do you want to join discussion? Click here to log in or create user.