You can only put the minus sign ("-") before a literal number.

Ej -12, - 4.4, -2/3, etc.

But not in front of any other "non number" object (from the parser
point of view):

Ej:

- #() size "only numbers may be negated"

What you want to do can be performed sending the message #negated to
the object returned by #width.

So #negatedWidth would be:

negatedWidth:
    ^self width negated

Regards!


Esteban A. Maringolo


2014-07-15 19:16 GMT-03:00 Verkoster Info <i...@derverkoster.de>:
> Hi,
>
> I am using latest Pharo 3.0 + vm.
>
> I have a method width with
> width
>
>         ^ 115 * self ratio.
> in my understanding it returns a Number.
>
> When I try to create a method
> negatedWidth
>
>         ^   - (self width).
>
> the UI tells me that only Numbers may be negated. I am not able to save the
> method. Am I on a wrong path or should that work and if how can I avoid the
> UI error message?
>
> Regards
>
> Max
>

Reply via email to