Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

noteq-definition

Flag a method definition for != (or ). Julia defines != as const != = !(==), so it is not meant to be overloaded: define == instead, and != follows automatically.

Defining != where == should carry the method:

!=(a::Grade, b::Grade) = a.score != b.score
warning: noteq-definition
 --> example.jl:1:1
  |
1 | !=(a::Grade, b::Grade) = a.score != b.score
  | ^^ `!=` is defined as `!(==)` and should not be overloaded; define `==` instead