Negation

In the previous example, I used the negation operator (!) in the expression !working_overtime, which can be read as “not working_overtime.” The negation operator can be used at the start of an expression; as an alternative, you can use the “not equals” (!= ) operator between the left and right sides of an expression:

negation.rb

!(1==1)         #=> false
1!=1            #=> false

Alternatively, you can use not instead of !:

not( 1==1 )        #=> false

Get The Book of Ruby now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.