How to write a not equal constraint?

How to write a not equal constraint? Like X != 0

These links should give you the general idea, which you can adapt, depending on integer vs. continuous.