Reverse a boolean with one line of code

How reverse a boolean with one line of code.

VB.net

MyVar = Not MyVar

PHP

$myvar = !$myvar;

C#

myvar = !myvar;

Python

my_var = not my_var

Go

MyVar = !MyVar

Javascript

myvar = !myvar;

Swift

MyBool = !MyBool;

Leave a Comment

Your email address will not be published. Required fields are marked *