Franck's answer is better (using ~), but I just wanted to point out that the conditional in yours is a bit redundant. Itβs easy to forget that since you already have a boolean, you donβt need to do a conditional comparison. So you could just do it ...
if x x = false; else x = true; end
Bob gilmore
source share