Suppose Variable “var” is the boolean type. You want to inverse itself.

bool var = 0;
var = 1 - var; // var == 1