.Maui Blog

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;

Exit mobile version