Ruby’s Unary Operators and How to Redefine Their Functionality

In math, a unary operation is an operation with a single input. In Ruby, a unary operator is an operator which only takes a single 'argument' in the form of a receiver. For example, the - on -5 or ! on!true. In contrast, a binary operator, such as in 2 + 3, deals with twoarguments. Here, 2 and 3 (which become one receiver and one argument in a method call to +).

#ruby #rails #rubyonrails #bosnia #programming #tutorials #news #rubydeveloper #railsdeveloper

Nezir Zahirovic

Freelance software developer Ruby On Rails (4 years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles