Use:

    puts -5


On 28 July 2014 17:34, Arup Rakshit <aruprakshit / rocketmail.com> wrote:

> If I write
>
> puts 10 - 5
> # gives 5, same as
> puts(10 -5)
>
> Now if I write
>
> puts(- 5)
> #gives -5
> But if I try -
> puts - 5
> # NoMethodError: undefined method `-' for nil:NilClass
>
> It seems, puts - 5 is parsed as (puts) - 5.
>
> But why not are we allowed to write the *unary* operation with `puts` like
> we are allowed with *binary* one ?
>
> Regards,
> Arup Rakshit
>



-- 
  Matthew Kerwin
  http://matthew.kerwin.net.au/