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’s Unary Operators and How to Redefine Their Functionality #ruby #rubydeveloper #rubyonrails https://rubyonrails.ba/single/rubys-unary-operators-and-how-to-redefine-their-functionality

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles